Search Postgresql Archives

Re: Which Java persistence library would you use with PostgreSQL?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To be more specific: When using Hibernate+Derby then in your persistence.xml there's a line like this:

<property name="hibernate.connection.url" value="jdbc:derby://localhost:1527/MySampleDb;create=true"/>

If you are using PostgreSQL the line would look like this:

<property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/MySampleDb"/>

If you add ";create=true" just as in the example above, it breaks the code and you get this as a result:

org.postgresql.util.PSQLException: FATAL: database "MySampleDb;create=true" does not exist at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:471) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:112) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125) at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22) at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:32)
	at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
	at org.postgresql.Driver.makeConnection(Driver.java:393)
	at org.postgresql.Driver.connect(Driver.java:267)
[...]

Isn't this automatical table creation possible with PostgreSQL at all? Thanks, again!
Bata


On 05/02/2012 12:15 PM, Bata Degen wrote:
Hi list,

what is your choice of trust when it comes to Java persistence libraries?

NetBeans gives me these out of the box:
EclipseLink (JPA 2.0)
Hibernate (JPA 1.0)
TopLink Essentials (JPA 1.0)

Is any of them known to work very well together with PostgreSQL? Or what
else can you recommend?

I am looking for a solution to do this (the direction is important, it's
not the other way around):
XML-Schema --[via Hyperjaxb3]--> annotated Java classes --[via JPA]-->
PostgreSQL

I've already managed to do the first two steps but would appreciate your
advice on the last step. I've done loads of tutorials. This one
http://bit.ly/b7vCkF for example employs Hibernate and the cool thing is
that you can let the relations be created for you automatically. But it
uses Apache Derby as the database backend. This is not what I want. I
want to use PostgreSQL. But when exchanging Derby for PostgreSQL
relations won't be created automatically anymore.

Has anyone done such magic things successfully with PostgreSQL and if
so, which persistence library where you using?

Thank you guys for your feedback!

Regards,
Bata



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux