Mixed persistence modes

Find a bug? Think you found a bug? We'll let you know what we know if you do the same!

Mixed persistence modes

Postby Jack » Mon Apr 16, 2012 1:37 am

I have been trying to set up a single application containing transactions going to a persistence unit using Cloudtran on Coherence, and a second persistence unit for direct to database jpa, bypassing Coherence entirely. As long as everything goes through Cloudtran, it works, but mixing persistence unit providers this way causes the direct jpa to give a null pointer exception on reading table sequence numbers from the database. I have used what appears to me to be the standard jpa table generator and the entities involved don't appear in the cloudtran persistence unit, nor are there any relations (with the supported version of Toplink Grid, I don't think these would be allowed anyway). I'm wondering if there is something that Cloudtran is relying on for all persistence units which are absent in the native jpa set up.
Jack
 
Posts: 2
Joined: Mon Apr 16, 2012 1:24 am

Re: Mixed persistence modes

Postby matthew » Thu Apr 26, 2012 7:10 am

There was a bug in the injection of CloudTran into the TopLink Sessions in this mixed usage.

If you just used our app, can you send the config (persistence.xml and anything else you've changed) so we can test the fix.

We'll get a fix for this into the 1.0 GA product.
matthew
 
Posts: 3
Joined: Thu Apr 12, 2012 1:11 am

Re: Mixed persistence modes

Postby Jack » Thu Apr 26, 2012 7:42 am

Hi, Matthew and thanks for responding. Yes, I have tried this by modifying your sample Child Activities app and got the same result. I'll append the persistence.xml I used when I did that. Hope that helps. Other main changes I made were to the entities Library and Book.

I removed the customiser and changed the sequence generation on Book/Library, so for example the begining of Library now looks like:

Code: Select all
@Entity(name = "Library")
@Table(name = "LIBRARY")
@TableGenerator(name="LibGen", allocationSize=1, table="ID_GEN",
      pkColumnName="ID_NAME", valueColumnName="ID_VAL", pkColumnValue="LibGen", initialValue=0)
public class Library implements Serializable, PortableObject
{
    private static final long serialVersionUID = 1;
    @Id
    @GeneratedValue(strategy=GenerationType.TABLE, generator="LibGen")
    private int id;


I also removed references to the Library and Book Wrapper objects in the application-pof-config.

Cheers,

Jack

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">

   <persistence-unit name="child-activities-server-1" transaction-type="RESOURCE_LOCAL">
      <provider>com.cloudtran.jpa.CTPersistenceProvider</provider>
                  <!-- The non-CloudTran default is:       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> -->
      <!-- These are the entities the persistence framework is aware of -->
      <class>cloudtran.model.Parent</class>
      <class>cloudtran.model.Child</class>
      <class>cloudtran.model.GrandChild</class>
      <class>cloudtran.model.Activity</class>
      <class>cloudtran.model.ActivityType</class>
      <properties>
         <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/cloudtranTest" />
         <property name="javax.persistence.jdbc.user" value="cloudtran" />
         <property name="javax.persistence.jdbc.password" value="cloudtran" />
         <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
         <property name="eclipselink.jdbc.read-connections.max" value="32" />
         <property name="eclipselink.jdbc.write-connections.max" value="32" />
         <property name="eclipselink.jdbc.batch-writing" value="JDBC" />
         <property name="eclipselink.target-database" value="MYSQL" />
      </properties>
   </persistence-unit>
      
   <persistence-unit name="child-activities-server-2" transaction-type="RESOURCE_LOCAL">
       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

      <!-- These are the entities what the persistence framework is aware of -->
      <class>cloudtran.model.Library</class>
      <class>cloudtran.model.Book</class>
      <properties>
         <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/cloudtranTest" />
         <property name="javax.persistence.jdbc.user" value="cloudtran" />
         <property name="javax.persistence.jdbc.password" value="cloudtran" />
         <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
         <property name="eclipselink.jdbc.read-connections.max" value="32" />
         <property name="eclipselink.jdbc.write-connections.max" value="32" />
         <property name="eclipselink.jdbc.batch-writing" value="JDBC" />
         <property name="eclipselink.target-database" value="MYSQL" />
         <property name="eclipselink.ddl-generation" value="create-tables"/>
      </properties>
   </persistence-unit>

</persistence>
Jack
 
Posts: 2
Joined: Mon Apr 16, 2012 1:24 am


Return to Bugs and Known Issues

Who is online

Users browsing this forum: No registered users and 1 guest

cron