开发者

Hibernate - How to control generator class used when running hbm2hbmxml

开发者 https://www.devze.com 2022-12-25 05:41 出处:网络
My hbm2hbmxml task is generating ids such as below <id name=\"id\" type=\"long\"> <column name=\"id\" />

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

精彩评论

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