I am trying to setup JPA with hibernate, and using JBoss to deploy. I am getting this error:
org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [TBL]
at org.hibernate.tool.schema.internal.SchemaValidatorImpl.validateTable(SchemaValidatorImpl.java:67)
at org.hibernate.tool.schema.internal.SchemaValidatorImpl.doValidation(SchemaValidatorImpl.java:50)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:91)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:473)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879)
... 9 more
But I do have a table called TBL in the database, created with this code:
create table TBL ( id number(10) not null primary key );
I’m using oracle, and this is my persistence.xml file:
I do have ojdbc6, version 11.2.0.3 in the pom.xml file.
This is the java class for that table:
@Entity
@Table(name = "TBL")
public class Tbl implements Serializable {
public enum EnumName { /*...*/ }
// private and public static final variables
@Id
private Long id;
public Tbl() {}
// some getters
}
If I connect to the database from command line, I can do a select on the table.
I tried changing from validate to update or create.
With update I still get the “Table not found: TBL” message every time I restart the server, so I’m guessing whatever hibernate is doing is not permanent.
With create, I see the sql code dropping and creating the tables. Then I switched back to validate and restarted to make sure it worked. I still got the missing table exception.
The stack trace of the error message was the same even on TRACE level. This is all of it:
org.jboss.msc.service.StartException in service jboss.persistenceunit."sockets.war#unit1": javax.persistence.PersistenceException: [PersistenceUnit: unit1] Unable to build Hibernate SessionFactory
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: unit1] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:954)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:882)
at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154)
... 7 more
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [ABILITIES]
at org.hibernate.tool.schema.internal.SchemaValidatorImpl.validateTable(SchemaValidatorImpl.java:67)
at org.hibernate.tool.schema.internal.SchemaValidatorImpl.doValidation(SchemaValidatorImpl.java:50)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:91)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:473)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879)
... 9 more
I meant I renamed it in the post, not in the code. As for the breakpoint, I’m starting the server from the commandline, not an IDE, so I don’t think I can create breakpoints.
Yes, you can. Just check the JBoss bat or sh file for more details. Search for debug and you will see what environment variable to set and the port used for remote debuging.
I put a breakpoint. metadata.database.jdbcEnvironment.currentSchema is null.
Does that mean it’s not connecting to the database? I can connect from command line so I don’t think it’s the firewall.