日期:2014-05-17  浏览次数:20789 次

hibernate反向生成报错 求解决(急)

Oracle表结构

 

反向生成后界面报错
 



Myeclipse日志报错
!ENTRY org.eclipse.core.jobs 4 2 2014-02-27 10:55:24.650
!MESSAGE An internal error occurred during: "Generating Artifacts".
!STACK 0
java.lang.NoSuchFieldError: BIG_DECIMAL
at com.pb.sas.util.CsglOracleDialect.<init>(CsglOracleDialect.java:11)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:78)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:409)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:119)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1929)
at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:73)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$7.execute(GenerateArtifactsJob.java:855)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:89)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:836)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:401)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

------解决方案--------------------
是不是在xxx.hbm.xml中配置有
<property name="bigDecimal" column="BIG_DECIMAL" />

------解决方案--------------------
你的代码中:
registerHibernateType(Types.DECIMAL, Hibernate.BIG_DECIMAL.getName());


是否应该修改为:
registerHibernateType(java.sql.Types.Number,Hibernate.Integer.getName());


------解决方案--------------------
推荐正向。。。