hibernate 的自动建表

蘑菇蘑菇 发布于 2013/07/25 11:03
阅读 796
收藏 0

hibernate 自动建表的问题

下面是consle 的输出。。。重要内容用红色标出了

Hibernate: insert into b_users (geo, unity_id) values (?, ?)

org.hibernate.exception.SQLGrammarException: could not insert: [com.test.HibernateTestEntity]

at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)

at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:64)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2176)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2656)

at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)

at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)

at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)

at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)

at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)

at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)

at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)

at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:563)

at org.hibernate.impl.SessionImpl.save(SessionImpl.java:551)

at org.hibernate.impl.SessionImpl.save(SessionImpl.java:547)

at com.test.HibernateTest.main(HibernateTest.java:22)

Caused by: java.sql.SQLException: [Vertica][VJDBC](4876) ERROR: Table "b_users" does not exist

at com.vertica.util.ServerErrorData.buildException(Unknown Source)

at com.vertica.io.ProtocolStream.readExpectedMessage(Unknown Source)

at com.vertica.dataengine.VDataEngine.prepareImpl(Unknown Source)

at com.vertica.dataengine.VDataEngine.prepare(Unknown Source)

at com.vertica.dataengine.VDataEngine.prepare(Unknown Source)

at com.vertica.jdbc.SPreparedStatement.<init>(Unknown Source)

at com.vertica.jdbc.VerticaPreparedStatementImpl.<init>(Unknown Source)

at com.vertica.jdbc.VJDBCObjectFactory.createPreparedStatement(Unknown Source)

at com.vertica.jdbc.SConnection.prepareStatement(Unknown Source)

at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)

at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:116)

at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:54)

... 16 more

Caused by: com.vertica.util.ServerException: [Vertica][VJDBC](4876) ERROR: Table "b_users" does not exist

... 28 more

这里是hibernate.cfg.xml配置


我想请问各位高手的是。。。都配置好了,为啥H不会自动建表


加载中
0
蘑菇蘑菇
蘑菇蘑菇

我用了MySQL方言,是不是不能用在vertica上面啊。但是hibernate没有vertica方言,而且vertica支持SQL。。。。。

0
daxiaoming
daxiaoming

方言是要和底层数据库对应起来的,否则建库失败。例如:mysql 方言就不能用在 oracle 上面。

你还是在本地装一个 mysql 吧。

返回顶部
顶部