开发者

Hibernate - How to control generator class used when running hbm2hbmxml

My hbm2hbmxml task is generating ids such as below

    <id name="id" type="long">
        <column name="id" />
        <generator class="assigned" />
    </id>

I'd like them all to be "native". Can I confi开发者_Python百科gure the Hibernate reverse engineering to do this?

Thx, Fred


Yes. You can create a custom ReverseEngineeringStrategy by extending DelegatingReverseEngineeringStrategy, override

@Override public String getTableIdentifierStrategyName(final TableIdentifier tableIdentifier) {

// Always use native identifier strategy

return "native"; }

and have HibernateToolTask refer to this class: reversestrategy="com.foo.MyReverseEngineeringStrategy"

Cheers, Kjeld

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜