aspose file tools*
The moose likes Object Relational Mapping and the fly likes Changing Session to EntityManager (hiberante) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Changing Session to EntityManager (hiberante)" Watch "Changing Session to EntityManager (hiberante)" New topic
Author

Changing Session to EntityManager (hiberante)

Inocencio Oliveira
Greenhorn

Joined: Oct 13, 2005
Posts: 23
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 ]

<b>Keep your mind flowing away!</b>
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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

Joined: Jul 14, 2005
Posts: 304
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"/>


-Mike
Pro JPA 2: Mastering the Java Persistence API
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Changing Session to EntityManager (hiberante)