Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Migrating Toplink CMP to TopLink/EclipseLink JPA(How to migrate cmp workbench based project to jpa based workbench based project)
Migrating Toplink CMP to TopLink/EclipseLink JPA [message #521727] Thu, 18 March 2010 15:25 Go to next message
Stefan Langer is currently offline Stefan LangerFriend
Messages: 236
Registered: July 2009
Senior Member
Hello,

I'm currently converting a project from Weblogic 8 using EJB 2.1 CMPs to Weblogic 10.0 using EJB 3.0 and JPA for persistence storage.

I have already changed all entities in the Toplink mapping workbench to Java POJOs and generated the appropriate entity classes. I then created the mapping file from the workbench (tried Toplink and EclipseLink Workbench) and tried to incorporate them into Weblogic 10.0 using a persistence.xml.

I have not generated a project file and included it. As far as I understand it this is not necessary when using toplink/eclipselink as a JPA provider.

The server starts up and I can obtain a EntityManager but as soon as I try to do a simple findByPrimaryKey search I get the notice that the entity is unknown.

To ease migration we do not want to use Annotation but the generated mapping file. But it seems that EclipseLink is not even reading the file.

For testing purposes I changed one of the entities to using annotations and voila EclipseLink finds the entity and initializes it and I can do a findByPrimaryKey on it but the documentation states that it should be enough to specify the mapping file.

My persistence.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="punit" transaction-type="JTA">

<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
<!--provider>org.eclipse.persistence.jpa.PersistenceProvider </provider-->
<jta-data-source>JTAsrc</jta-data-source>
<non-jta-data-source>nonJTASrc</non-jta-data-source>

<properties>


<!-- properties to fine tune logging -->
<property name="eclipselink.target-server" value="WebLogic_10"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.logging.timestamp" value="false"/>
<property name="eclipselink.logging.thread" value="false"/>
<property name="eclipselink.logging.session" value="false"/>
</properties>
</persistence-unit>

</persistence>

I also tried to specify a standard jpa orm.xml and I see Eclipselink configuring the entities just as when I used annotations. It just doesn't load the mappings that are specified in the workbench mapping file.

Can anybody help me out or point me to some resource where a migration from cmp to jpa is documented in the context of weblogic and toplink/eclipselink?

Many thanks
-Stefan
Re: Migrating Toplink CMP to TopLink/EclipseLink JPA [message #522475 is a reply to message #521727] Mon, 22 March 2010 17:59 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

In order to use the old native EclipseLink meta-data instead of the JPA meta-data you need to have the EclipseLink project.xml (generated from the MW) and a sessions.xml, and then link your persistence.xml to the sessions.xml.

See,
http://wiki.eclipse.org/EclipseLink/Examples/JPA/NativeMetad ata

Or, you can remap the model using JPA annotations, or JPA orm.xml (or use defaults and just specify @Entity and @Id).



James : Wiki : Book : Blog : Twitter
Previous Topic:Fetch Join Problem
Next Topic:ValueHolder eats memory
Goto Forum:
  


Current Time: Fri Apr 26 00:56:44 GMT 2024

Powered by FUDForum. Page generated in 0.02790 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top