开发者

Using same hbm for multiple databases

We are using hibernate in our project. We have have 2 databases(ORACLE and MYSQL). Currently we want to create sequences on oracle, so changes are done on hbm to use sequences for generator. But as same hbm is used when connected t开发者_运维问答o MYSQL and MYSQL doesn't support sequences, So Is there a way to use same hbm files for both the dbs.

Thanks in advance

Yogesh


If you want to target Oracle database, you can keep compatibility with 'auto-increment' databases such as MySQL by using the "native" id generator. This also accepts the 'sequence' parameter if you want to name a specific ORACLE sequence. This is ignored when using a database that supports 'auto-increment' columns.

    <generator class="native">
        <param name="sequence">MY_ORACLE_SEQUENCE</param>
    </generator>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜