• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing Session to EntityManager (hiberante)

 
Inocencio Oliveira
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was changing the connection context from my application. I�m trying to get EntityManager pattern up.

I created a persistence.xml and defined some tags:



Hence, my database is a H2 link here. I chose this to run my app into a local context, because the other database must be SQL Server, and I need to work with both.

In hibernate session context, My connect was running ok, creating automatic DDL, inserting, retrieving datas, deleting, everything was ok, but now I am trying to use EntityManager pattern with JPA and some stuffs are getting wrong like that:

:arrow: It�s doesn�t knows any H2 dialect. Appears some warning information:



And the hibernate try to create the tables but something get wrong when it�s try to create sequence

I was defined sequence schema into my persistence class like:



So, hibernate show an error message:



I really don�t know how to fix it. In the session context everything was ok, but now everything get wrong. I have to fix it and put H2 to work with toplink JPA EntityManager context.

Someone have done H2 running with this context?

Thanks all!
[ December 28, 2007: Message edited by: Inocencio Oliveira ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the main thing I see, is that you have both Toplink and Hibernate in your persistence.xml. Which one are you actually using?

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so based on your errors (both are coming from Toplink) you are using Toplink, so remove the Hibernate property and use a Toplink property for the dialect.

Mark
 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error message is just TopLink Essentials telling you to set the database platform using the toplink "toplink.platform.class.name" property. So, to use SQL Server you would specify the SQL Server platform class:

<property
name="toplink.platform.class.name"
value="oracle.toplink.essentials.platform.database.SQLServerPlatform"/>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic