Hi Vlad,
I’m not generating schema through JPA/Hibernate. I don’t think internally JUnit would be using hbm2ddl, unless it is specified in persistence.xml. I tried to execute login() method without JUnit and it’s working. The Database schema is already in place, using MySql. If I understand correctly hbm2ddl is used to validate or exports schema DDL to database using SessionFactory. Further I’m following JPA specifications, so using EntityManager. Here is persistence.xml :
<persistence-unit name="WebAppPU">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.itsys.erp.server.dal.entities.City</class>
<class>com.itsys.erp.server.dal.entities.Country</class>
<class>com.itsys.erp.server.dal.entities.Customer</class>
<class>com.itsys.erp.server.dal.entities.FpPackageMaterial</class>
<class>com.itsys.erp.server.dal.entities.FpRawMaterial</class>
<class>com.itsys.erp.server.dal.entities.Machine</class>
<class>com.itsys.erp.server.dal.entities.Product</class>
<class>com.itsys.erp.server.dal.entities.ProductType</class>
<class>com.itsys.erp.server.dal.entities.ProductionLog</class>
<class>com.itsys.erp.server.dal.entities.ProductionSchedule</class>
<class>com.itsys.erp.server.dal.entities.Purchase</class>
<class>com.itsys.erp.server.dal.entities.PurchaseDtl</class>
<class>com.itsys.erp.server.dal.entities.PurchaseOrder</class>
....
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/erp_mini" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="root" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
Saw some solutions on on other sites for similar exceptions / problems, where some were using DB reserved keywords for table like user. Here I’m not able to trace any flaw, any idea what could be the reason? Pelase help.