0
votes

I've setup a datasource on JBoss to connect to eap 6.2 to Postgresql 9.3.2. I'm using the postgresql-9.3-1100.jdbc4.jar driver. It connects successfully when using the test connection button in JBoss admin console.

When trying to connect (query/persist) a entity via java it gives me the following error:

org.postgresql.util.PSQLException: ERROR: relation "student" does not exist

I've added the following line in the persistence.xml to include the schema

<property name="hibernate.default_schema" value="archu"/>

But the error now just includes the schema:

org.postgresql.util.PSQLException: ERROR: relation "archu.student" does not exist

I've queried the database via Netbeans and it works by modifying the "archu.student" to say archu."Student".

In the database the table Student is spelled using a uppercase s but JBoss datasource uses lowercase. Also the JBoss datasource appends the schema but the "" is around archu and student which doesn't want to work.

Is there a better way to specify the schema in the datasource and tell the datasource not to make everything lowercase?.

1

1 Answers

0
votes

I have ask hibernate to drop and create the tables for me.

Persistence.xml entry:

<property name="hibernate.hbm2ddl.auto" value="create-drop"/>

With the following enabled I can see what the difference is.

The table gets created with name "student" all lowercase even though the entity is named Student" uppercase S.

It works with the combination of the newly created table via hibernate and the entry of the schema in the persistence.xml.