无法确定以下列的类型:TIMESTAMP,位于表:

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.xml


private 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();


        } 

宝慕林4294392
浏览 101回答 1
1回答

慕田峪4524236

将所有小写字母“时间戳”而不是大写字母放在 hbm.xml 文件中。像这样:<property&nbsp;name="addUserDtm"&nbsp;column="ADD_USER_DTM"&nbsp;type="timestamp"&nbsp;/>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java