Exception in thread "main" org.hibernate.MappingException: Could not determine type for: TIMESTAMP, at table: BATCH_JOB_CONFIG_DTLS, for columns: [org.hibernate.mapping.Column(ADD_USER_DTM)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:486) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:453) at org.hibernate.mapping.Property.isValid(Property.java:226) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:624) at org.hibernate.mapping.RootClass.validate(RootClass.java:267) at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:347) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:466) at com.hms.api.batch.job.config.StartBatchJobConfigApplication.createSession(StartBatchJobConfigApplication.java:71) at com.hms.api.batch.job.config.StartBatchJobConfigApplication.main(StartBatchJobConfigApplication.java:38)以下是我的代码。在 Main 中调用 createSession() 方法。我有两个实体类。数据库连接在我的休眠状态中提供.cfg.xmlprivate static void createSession() { StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().configure("hibernate.cfg.xml").build(); Metadata meta = new MetadataSources(ssr).getMetadataBuilder().build(); SessionFactory factory = meta.getSessionFactoryBuilder().build(); Session session = factory.openSession(); Transaction t = session.beginTransaction(); SessionFactory fact = meta.getSessionFactoryBuilder().build(); Session ss = factory.openSession(); Transaction tt = session.beginTransaction(); }
1 回答
慕田峪4524236
TA贡献1875条经验 获得超5个赞
将所有小写字母“时间戳”而不是大写字母放在 hbm.xml 文件中。像这样:
<property name="addUserDtm" column="ADD_USER_DTM" type="timestamp" />
添加回答
举报
0/150
提交
取消
