Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problem with persistence cache using JPA
Problem with persistence cache using JPA [message #376350] Tue, 15 July 2008 21:01 Go to next message
Brett Bergquist is currently offline Brett BergquistFriend
Messages: 31
Registered: July 2009
Member
I'm having a problem with my J2EE application and after many hours of debugging
I have been able to distill the problem down into a small testable application.

My J2EE application consists of using the Command pattern and various Commands
can be strung together to accomplish a desired goal. These Commands when strung
together are executed within a Container Managed transaction and EntityManager.
This is the reason that the flow that I present below is done and I have no
easy way that I can change it.

Basically I have two entity classes: Parent and Child. Parent is created
with one Child automatically and other Child entities can be added. There
is a @OneToMany and @ManyToOne relationship between Parent and Child.

The problem that I am seeing is that I create a Parent, get another
handle to the parent using EntityManager.find, update the Parent,
create 3 more children for a total of 4, and commit. This commits fine
and the underlying database is correct. In a separate transaction, I find
the Parent and count the children which indicates that there are only
3 children instead of the 4 that are actually in the database.

From what I found, if I remove the @Version field on the parent, then
this problem goes away but then I cannot do optimistic locking.

Also in the code below, if I remove he "p1.setSerialNumber" invocation
the problem does not occur.

So I'm looking for some help into why this problem is occurring. I
think it has something to do with the @version and optimistic locking
but I don't know how to get around it.



Here is the main test application code. I build a small J2SE application
using user controlled transactions just for testing purposes and the
problem is still exhibited:

-- Main.java
package stest;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;

public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Integer id = create();
getCount(id);
}

public static Integer create() {
Integer id = null;

EntityManagerFactory emf = javax.persistence.Persistence.createEntityManagerFactory("stestPU ");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
try {
Parent p0 = new Parent(false);
em.persist(p0);
em.flush();

Parent p1 = em.find(Parent.class, p0.getId());
// VVVVVV
p1.setSerialNumber("12345678");
// ^^^^^^

Child cs_1_1 = new Child();
p1.addChild(cs_1_1);
em.flush();

Child cs_1_2 = new Child();
p1.addChild(cs_1_2);
em.flush();

Parent chassis2 = em.find(Parent.class, p0.getId());
Child cs_2_1 = new Child();
chassis2.addChild(cs_2_1);
em.flush();

em.getTransaction().commit();
id = p1.getId();
} catch (Exception e) {
e.printStackTrace();
em.getTransaction().rollback();
} finally {
em.close();
}
return id;
}

public static void getCount(Integer id) {
EntityManagerFactory emf = javax.persistence.Persistence.createEntityManagerFactory("stestPU ");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
try {
Parent chassis = em.find(Parent.class, id);
int count = chassis.getChildren().size();
System.out.println("config set count is " + count);
em.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
em.getTransaction().rollback();
} finally {
em.close();
}
}
}
--

Here is the Parent Entity:

-- Parent.java
package stest;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Version;

@Entity
public class Parent implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column
private Integer id;

protected Parent() {
}

public Parent(boolean template) {
Child child = new Child();
addChild(child);
}

public Integer getId() {
return this.id;
}

public void setId(Integer id) {
this.id = id;
}

@Version
@Column
private int version;

public int getVersion() {
return version;
}

@OneToMany(mappedBy = "parent", cascade = {CascadeType.ALL})
private List<Child> children = new ArrayList<Child>();

public List<Child> getChildren() {
return children;
}

public void setChildren(List<Child> children) {
this.children = children;
}

public void addChild(Child cs) {
cs.setParent(this);
this.children.add(cs);
}

@Column
private String serialNumber;

public String getSerialNumber() {
return this.serialNumber;
}

public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
}
--

Here is the Child entity:

-- Child.java
package stest;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

@Entity
public class Child implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column
private Integer id;

public Child() {
}

public Integer getId() {
return this.id;
}

public void setId(Integer id) {
this.id = id;
}

@Version
@Column
private int version;

public int getVersion() {
return version;
}

@ManyToOne(cascade = {CascadeType.ALL})
private Parent parent;

public Parent getParent() {
return parent;
}

public void setParent(Parent parent) {
this.parent = parent;
}

@Temporal(TemporalType.TIMESTAMP)
@Column
private Date createdOn = new Date();

public Date getCreatedOn() {
return this.createdOn;
}

protected void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;
}
}
Re: Problem with persistence cache using JPA [message #376354 is a reply to message #376350] Wed, 16 July 2008 13:21 Go to previous messageGo to next message
James is currently offline JamesFriend
Messages: 272
Registered: July 2009
Senior Member
Very odd issue.

If removing the version or serialNumber makes the issue go away, it sounds
like your commit must be failing somehow (or perhaps the merge). Ensure
that you do not get any errors in any of the flush or the commit.

In you test code the find for the parent should return the identical
object in each case, verify that the find return is == p0. Also try
removing the flushes to see if they issue goes away.

Your could is using application managed entity managers and transactions.
Ensure that you are not using a JTA DataSource.

Also enable logging to finest and include the log.

-- James
Re: Problem with persistence cache using JPA [message #376361 is a reply to message #376354] Thu, 17 July 2008 12:12 Go to previous message
Brett Bergquist is currently offline Brett BergquistFriend
Messages: 31
Registered: July 2009
Member
All transactions are committed. In my real application I cannot remove the flush calls because I need the ID's that are going to be
assigned. I have also verified that "p0 == p1". I also watched the interaction via the debugger and see that when I update the
serial number that the same object pointed to by "p0" and "p1" shows the update so that is a second way that I verified that I don't
have distinct objects.

Here is the log when run. I added a little code to print out the children that are seen in the second transactions.

init:
deps-jar:
Copying 1 file to C:\src\stest\build\classes
compile:
run:
[EL Finest]: 2008.07.17 08:09:20.830--ServerSession(26435810)--Thread(Thread[main,5, main])--Begin predeploying Persistence Unit
stestPU; state Initial; factoryCount 0
[EL Finest]: 2008.07.17 08:09:20.877--ServerSession(26435810)--Thread(Thread[main,5, main])--property=eclipselink.weaving; value=false
[EL Finest]: 2008.07.17
08:09:20.877--ServerSession(26435810)--Thread(Thread[main,5, main])--property=eclipselink.orm.throw.exceptions; default value=true
[EL Finer]: 2008.07.17 08:09:20.877--ServerSession(26435810)--Thread(Thread[main,5, main])--Searching for default mapping file in
file:/C:/src/stest/build/classes/
[EL Finer]: 2008.07.17 08:09:20.877--ServerSession(26435810)--Thread(Thread[main,5, main])--Searching for default mapping file in
file:/C:/src/stest/build/classes/
[EL Config]: 2008.07.17 08:09:21.143--ServerSession(26435810)--Thread(Thread[main,5, main])--The alias name for the entity class
[class stest.Child] is being defaulted to: Child.
[EL Config]: 2008.07.17 08:09:21.143--ServerSession(26435810)--Thread(Thread[main,5, main])--The table name for entity [class
stest.Child] is being defaulted to: CHILD.
[EL Config]: 2008.07.17 08:09:21.205--ServerSession(26435810)--Thread(Thread[main,5, main])--The column name for element [private
java.lang.Integer stest.Child.id] is being defaulted to: ID.
[EL Config]: 2008.07.17 08:09:21.205--ServerSession(26435810)--Thread(Thread[main,5, main])--The column name for element [private
java.lang.Integer stest.Child.version] is being defaulted to: VERSION.
[EL Config]: 2008.07.17 08:09:21.237--ServerSession(26435810)--Thread(Thread[main,5, main])--The column name for element [private
java.util.Date stest.Child.createdOn] is being defaulted to: CREATEDON.
[EL Config]: 2008.07.17 08:09:21.237--ServerSession(26435810)--Thread(Thread[main,5, main])--The alias name for the entity class
[class stest.Parent] is being defaulted to: Parent.
[EL Config]: 2008.07.17 08:09:21.237--ServerSession(26435810)--Thread(Thread[main,5, main])--The table name for entity [class
stest.Parent] is being defaulted to: PARENT.
[EL Config]: 2008.07.17 08:09:21.237--ServerSession(26435810)--Thread(Thread[main,5, main])--The column name for element [private
java.lang.Integer stest.Parent.id] is being defaulted to: ID.
[EL Config]: 2008.07.17 08:09:21.237--ServerSession(26435810)--Thread(Thread[main,5, main])--The column name for element [private
java.lang.Integer stest.Parent.version] is being defaulted to: VERSION.
[EL Config]: 2008.07.17 08:09:21.268--ServerSession(26435810)--Thread(Thread[main,5, main])--The column name for element [private
java.lang.String stest.Parent.serialNumber] is being defaulted to: SERIALNUMBER.
[EL Config]: 2008.07.17 08:09:21.268--ServerSession(26435810)--Thread(Thread[main,5, main])--The target entity (reference) class for
the many to one mapping element [private stest.Parent stest.Child.parent] is being defaulted to: class stest.Parent.
[EL Config]: 2008.07.17 08:09:21.299--ServerSession(26435810)--Thread(Thread[main,5, main])--The primary key column name for the
mapping element [private stest.Parent stest.Child.parent] is being defaulted to: ID.
[EL Config]: 2008.07.17 08:09:21.299--ServerSession(26435810)--Thread(Thread[main,5, main])--The foreign key column name for the
mapping element [private stest.Parent stest.Child.parent] is being defaulted to: PARENT_ID.
[EL Config]: 2008.07.17 08:09:21.299--ServerSession(26435810)--Thread(Thread[main,5, main])--The target entity (reference) class for
the one to many mapping element [private java.util.List stest.Parent.children] is being defaulted to: class stest.Child.
[EL Finest]: 2008.07.17 08:09:21.330--ServerSession(26435810)--Thread(Thread[main,5, main])--End predeploying Persistence Unit
stestPU; state Predeployed; factoryCount 0
[EL Finer]: 2008.07.17 08:09:21.330--Thread(Thread[main,5,main])--JavaSECMPInitiali zer - transformer is null.
[EL Finest]: 2008.07.17 08:09:21.330--ServerSession(26435810)--Thread(Thread[main,5, main])--Begin predeploying Persistence Unit
stestPU; state Predeployed; factoryCount 0
[EL Finest]: 2008.07.17 08:09:21.330--ServerSession(26435810)--Thread(Thread[main,5, main])--End predeploying Persistence Unit
stestPU; state Predeployed; factoryCount 1
[EL Finest]: 2008.07.17 08:09:21.330--ServerSession(26435810)--Thread(Thread[main,5, main])--Begin deploying Persistence Unit
stestPU; state Predeployed; factoryCount 1
[EL Finest]: 2008.07.17 08:09:21.377--ServerSession(26435810)--Thread(Thread[main,5, main])--property=eclipselink.logging.level;
value=FINEST; translated value=FINEST
[EL Finest]: 2008.07.17 08:09:21.377--ServerSession(26435810)--Thread(Thread[main,5, main])--property=eclipselink.logging.level;
value=FINEST; translated value=FINEST
[EL Finest]: 2008.07.17 08:09:21.377--ServerSession(26435810)--Thread(Thread[main,5, main])--property=eclipselink.jdbc.user; value=app
[EL Finest]: 2008.07.17 08:09:21.377--ServerSession(26435810)--Thread(Thread[main,5, main])--property=eclipselink.jdbc.password;
value=xxxxxx
[EL Finest]: 2008.07.17 08:09:31.487--ServerSession(26435810)--Thread(Thread[main,5, main])--property=eclipselink.jdbc.driver;
value=org.apache.derby.jdbc.ClientDriver
[EL Finest]: 2008.07.17 08:09:31.487--ServerSession(26435810)--Thread(Thread[main,5, main])--property=eclipselink.jdbc.url;
value=jdbc:derby://localhost:1527/sample
[EL Info]: 2008.07.17 08:09:31.487--ServerSession(26435810)--Thread(Thread[main,5, main])--EclipseLink, version: Eclipse Persistence
Services - 1.0 (Build 1.0 - 20080707)
[EL Finest]: 2008.07.17 08:09:31.893--Thread(Thread[main,5,main])--DBPlatform:
org.eclipse.persistence.platform.database.InformixPlatform, RegularExpression: (?i)informix.*.
[EL Finest]: 2008.07.17 08:09:31.893--Thread(Thread[main,5,main])--DBPlatform:
org.eclipse.persistence.platform.database.PointBasePlatform, RegularExpression: (?i)pointbase.*.
[EL Finest]: 2008.07.17 08:09:31.893--Thread(Thread[main,5,main])--DBPlatform:
org.eclipse.persistence.platform.database.DB2Platform, RegularExpression: (?i).*db2.*.
[EL Finest]: 2008.07.17 08:09:31.893--Thread(Thread[main,5,main])--DBPlatform:
org.eclipse.persistence.platform.database.SQLServerPlatform, RegularExpression: (?i)microsoft.*.
[EL Finest]: 2008.07.17 08:09:31.893--Thread(Thread[main,5,main])--DBPlatform:
org.eclipse.persistence.platform.database.PostgreSQLPlatform , RegularExpression: (?i)postgresql.*.
[EL Finest]: 2008.07.17 08:09:31.893--Thread(Thread[main,5,main])--DBPlatform:
org.eclipse.persistence.platform.database.SybasePlatform, RegularExpression: (?i)(sybase.*)|(adaptive server enterprise.*)|(SQL Server).
[EL Finest]: 2008.07.17 08:09:31.893--Thread(Thread[main,5,main])--DBPlatform:
org.eclipse.persistence.platform.database.JavaDBPlatform, RegularExpression: (?i).*derby.
[EL Fine]: 2008.07.17 08:09:31.893--Thread(Thread[main,5,main])--Detected Vendor platform:
org.eclipse.persistence.platform.database.JavaDBPlatform
[EL Config]: 2008.07.17
08:09:31.924--ServerSession(26435810)--Connection(25218858)- -Thread(Thread[main,5,main])--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> "app"
datasource URL=> "jdbc:derby://localhost:1527/sample"
))
[EL Config]: 2008.07.17 08:09:31.924--ServerSession(26435810)--Connection(15612583)- -Thread(Thread[main,5,main])--Connected:
jdbc:derby://localhost:1527/sample
User: app
Database: Apache Derby Version: 10.2.2.0 - (485682)
Driver: Apache Derby Network Client JDBC Driver Version: 10.4.1.3 - (648739)
[EL Config]: 2008.07.17
08:09:31.924--ServerSession(26435810)--Connection(5035392)-- Thread(Thread[main,5,main])--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> "app"
datasource URL=> "jdbc:derby://localhost:1527/sample"
))
[EL Config]: 2008.07.17 08:09:31.940--ServerSession(26435810)--Connection(5569009)-- Thread(Thread[main,5,main])--Connected:
jdbc:derby://localhost:1527/sample
User: app
Database: Apache Derby Version: 10.2.2.0 - (485682)
Driver: Apache Derby Network Client JDBC Driver Version: 10.4.1.3 - (648739)
[EL Config]: 2008.07.17
08:09:31.940--ServerSession(26435810)--Connection(15038164)- -Thread(Thread[main,5,main])--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> "app"
datasource URL=> "jdbc:derby://localhost:1527/sample"
))
[EL Config]: 2008.07.17 08:09:31.940--ServerSession(26435810)--Connection(14452459)- -Thread(Thread[main,5,main])--Connected:
jdbc:derby://localhost:1527/sample
User: app
Database: Apache Derby Version: 10.2.2.0 - (485682)
Driver: Apache Derby Network Client JDBC Driver Version: 10.4.1.3 - (648739)
[EL Config]: 2008.07.17
08:09:31.940--ServerSession(26435810)--Connection(1947116)-- Thread(Thread[main,5,main])--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> "app"
datasource URL=> "jdbc:derby://localhost:1527/sample"
))
[EL Config]: 2008.07.17 08:09:31.940--ServerSession(26435810)--Connection(9613729)-- Thread(Thread[main,5,main])--Connected:
jdbc:derby://localhost:1527/sample
User: app
Database: Apache Derby Version: 10.2.2.0 - (485682)
Driver: Apache Derby Network Client JDBC Driver Version: 10.4.1.3 - (648739)
[EL Config]: 2008.07.17
08:09:31.940--ServerSession(26435810)--Connection(13367741)- -Thread(Thread[main,5,main])--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> "app"
datasource URL=> "jdbc:derby://localhost:1527/sample"
))
[EL Config]: 2008.07.17 08:09:31.940--ServerSession(26435810)--Connection(24713456)- -Thread(Thread[main,5,main])--Connected:
jdbc:derby://localhost:1527/sample
User: app
Database: Apache Derby Version: 10.2.2.0 - (485682)
Driver: Apache Derby Network Client JDBC Driver Version: 10.4.1.3 - (648739)
[EL Config]: 2008.07.17
08:09:31.940--ServerSession(26435810)--Connection(22310332)- -Thread(Thread[main,5,main])--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> "app"
datasource URL=> "jdbc:derby://localhost:1527/sample"
))
[EL Config]: 2008.07.17 08:09:31.955--ServerSession(26435810)--Connection(32542424)- -Thread(Thread[main,5,main])--Connected:
jdbc:derby://localhost:1527/sample
User: app
Database: Apache Derby Version: 10.2.2.0 - (485682)
Driver: Apache Derby Network Client JDBC Driver Version: 10.4.1.3 - (648739)
[EL Config]: 2008.07.17
08:09:31.955--ServerSession(26435810)--Connection(3288014)-- Thread(Thread[main,5,main])--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> "app"
datasource URL=> "jdbc:derby://localhost:1527/sample"
))
[EL Config]: 2008.07.17 08:09:31.955--ServerSession(26435810)--Connection(31056514)- -Thread(Thread[main,5,main])--Connected:
jdbc:derby://localhost:1527/sample
User: app
Database: Apache Derby Version: 10.2.2.0 - (485682)
Driver: Apache Derby Network Client JDBC Driver Version: 10.4.1.3 - (648739)
[EL Finest]: 2008.07.17 08:09:31.971--ServerSession(26435810)--Thread(Thread[main,5, main])--sequencing connected, state is
NoPreallocation_State
[EL Finest]: 2008.07.17 08:09:31.971--ServerSession(26435810)--Thread(Thread[main,5, main])--sequence SEQ_GEN_IDENTITY: preallocation
size 1
[EL Info]: 2008.07.17 08:09:32.033--ServerSession(26435810)--Thread(Thread[main,5, main])--file:/C:/src/stest/build/classes/-stestPU
login successful
[EL Finest]: 2008.07.17 08:09:32.049--ServerSession(26435810)--Thread(Thread[main,5, main])--Execute query DataModifyQuery()
[EL Fine]: 2008.07.17 08:09:32.065--ServerSession(26435810)--Connection(5569009)-- Thread(Thread[main,5,main])--ALTER TABLE CHILD
DROP CONSTRAINT FK_CHILD_PARENT_ID
[EL Finest]: 2008.07.17 08:09:32.190--ServerSession(26435810)--Thread(Thread[main,5, main])--Execute query DataModifyQuery()
[EL Fine]: 2008.07.17 08:09:32.190--ServerSession(26435810)--Connection(15612583)- -Thread(Thread[main,5,main])--DROP TABLE CHILD
[EL Finest]: 2008.07.17 08:09:32.237--ServerSession(26435810)--Thread(Thread[main,5, main])--Execute query DataModifyQuery()
[EL Fine]: 2008.07.17 08:09:32.237--ServerSession(26435810)--Connection(5569009)-- Thread(Thread[main,5,main])--CREATE TABLE CHILD
(ID INTEGER GENERATED ALWAYS AS IDENTITY NOT NULL, VERSION INTEGER, CREATEDON TIMESTAMP, PARENT_ID INTEGER, PRIMARY KEY (ID))
[EL Finest]: 2008.07.17 08:09:32.268--ServerSession(26435810)--Thread(Thread[main,5, main])--Execute query DataModifyQuery()
[EL Fine]: 2008.07.17 08:09:32.268--ServerSession(26435810)--Connection(15612583)- -Thread(Thread[main,5,main])--DROP TABLE PARENT
[EL Finest]: 2008.07.17 08:09:32.408--ServerSession(26435810)--Thread(Thread[main,5, main])--Execute query DataModifyQuery()
[EL Fine]: 2008.07.17 08:09:32.408--ServerSession(26435810)--Connection(5569009)-- Thread(Thread[main,5,main])--CREATE TABLE PARENT
(ID INTEGER GENERATED ALWAYS AS IDENTITY NOT NULL, VERSION INTEGER, SERIALNUMBER VARCHAR(255), PRIMARY KEY (ID))
[EL Finest]: 2008.07.17 08:09:32.502--ServerSession(26435810)--Thread(Thread[main,5, main])--Execute query DataModifyQuery()
[EL Fine]: 2008.07.17 08:09:32.502--ServerSession(26435810)--Connection(15612583)- -Thread(Thread[main,5,main])--ALTER TABLE CHILD
ADD CONSTRAINT FK_CHILD_PARENT_ID FOREIGN KEY (PARENT_ID) REFERENCES PARENT (ID)
[EL Finest]: 2008.07.17 08:09:32.549--ServerSession(26435810)--Thread(Thread[main,5, main])--End deploying Persistence Unit stestPU;
state Deployed; factoryCount 1
[EL Finer]: 2008.07.17 08:09:32.580--ServerSession(26435810)--Thread(Thread[main,5, main])--client acquired
[EL Finest]: 2008.07.17 08:09:32.580--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--PERSIST operation called on:
stest.Parent@1c7865b.
[EL Finest]: 2008.07.17 08:09:32.580--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--PERSIST operation called on:
stest.Child@1412e75.
[EL Finer]: 2008.07.17 08:09:32.612--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--begin transaction
[EL Finest]: 2008.07.17 08:09:32.612--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
InsertObjectQuery(stest.Parent@1c7865b)
[EL Fine]: 2008.07.17 08:09:32.627--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--INSERT IGNORE INTO PARENT
(VERSION, SERIALNUMBER) VALUES (?, ?)
bind => [1, null]
[EL Finest]: 2008.07.17 08:09:32.643--ClientSession(18206828)--Thread(Thread[main,5, main])--Execute query ValueReadQuery()
[EL Fine]: 2008.07.17 08:09:32.643--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--values
IDENTITY_VAL_LOCAL()
[EL Finest]: 2008.07.17 08:09:32.674--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--assign sequence to the object (1 ->
stest.Parent@1c7865b)
[EL Finest]: 2008.07.17 08:09:32.674--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
InsertObjectQuery(stest.Child@1412e75)
[EL Finest]: 2008.07.17 08:09:32.674--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
WriteObjectQuery(stest.Parent@1c7865b)
[EL Fine]: 2008.07.17 08:09:32.674--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--INSERT IGNORE INTO CHILD
(VERSION, CREATEDON, PARENT_ID) VALUES (?, ?, ?)
bind => [1, 2008-07-17 08:09:32.58, 1]
[EL Finest]: 2008.07.17 08:09:32.690--ClientSession(18206828)--Thread(Thread[main,5, main])--Execute query ValueReadQuery()
[EL Fine]: 2008.07.17 08:09:32.690--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--values
IDENTITY_VAL_LOCAL()
[EL Finest]: 2008.07.17 08:09:32.690--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--assign sequence to the object (1 ->
stest.Child@1412e75)
[EL Finest]: 2008.07.17 08:09:32.690--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query ReadObjectQuery(stest.Parent)
[EL Finest]: 2008.07.17 08:09:32.690--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--PERSIST operation called on: stest.Child@4d2af2.
[EL Finest]: 2008.07.17 08:09:32.690--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
UpdateObjectQuery(stest.Parent@1c7865b)
[EL Fine]: 2008.07.17 08:09:32.690--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--UPDATE PARENT SET
SERIALNUMBER = ?, VERSION = ? WHERE ((ID = ?) AND (VERSION = ?))
bind => [12345678, 2, 1, 1]
[EL Finest]: 2008.07.17 08:09:32.705--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
InsertObjectQuery(stest.Child@4d2af2)
[EL Finest]: 2008.07.17 08:09:32.705--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
WriteObjectQuery(stest.Parent@1c7865b)
[EL Fine]: 2008.07.17 08:09:32.705--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--INSERT IGNORE INTO CHILD
(VERSION, CREATEDON, PARENT_ID) VALUES (?, ?, ?)
bind => [1, 2008-07-17 08:09:32.69, 1]
[EL Finest]: 2008.07.17 08:09:32.705--ClientSession(18206828)--Thread(Thread[main,5, main])--Execute query ValueReadQuery()
[EL Fine]: 2008.07.17 08:09:32.705--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--values
IDENTITY_VAL_LOCAL()
[EL Finest]: 2008.07.17 08:09:32.705--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--assign sequence to the object (2 ->
stest.Child@4d2af2)
[EL Finest]: 2008.07.17 08:09:32.705--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--PERSIST operation called on:
stest.Child@14e45b3.
[EL Finest]: 2008.07.17 08:09:32.705--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
UpdateObjectQuery(stest.Parent@1c7865b)
[EL Finest]: 2008.07.17 08:09:32.705--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
InsertObjectQuery(stest.Child@14e45b3)
[EL Finest]: 2008.07.17 08:09:32.705--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
WriteObjectQuery(stest.Parent@1c7865b)
[EL Fine]: 2008.07.17 08:09:32.705--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--INSERT IGNORE INTO CHILD
(VERSION, CREATEDON, PARENT_ID) VALUES (?, ?, ?)
bind => [1, 2008-07-17 08:09:32.705, 1]
[EL Finest]: 2008.07.17 08:09:32.721--ClientSession(18206828)--Thread(Thread[main,5, main])--Execute query ValueReadQuery()
[EL Fine]: 2008.07.17 08:09:32.721--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--values
IDENTITY_VAL_LOCAL()
[EL Finest]: 2008.07.17 08:09:32.721--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--assign sequence to the object (3 ->
stest.Child@14e45b3)
[EL Finest]: 2008.07.17 08:09:32.721--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query ReadObjectQuery(stest.Parent)
[EL Finest]: 2008.07.17 08:09:32.721--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--PERSIST operation called on:
stest.Child@1700391.
[EL Finest]: 2008.07.17 08:09:32.721--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
UpdateObjectQuery(stest.Parent@1c7865b)
[EL Finest]: 2008.07.17 08:09:32.721--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
InsertObjectQuery(stest.Child@1700391)
[EL Finest]: 2008.07.17 08:09:32.721--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--Execute query
WriteObjectQuery(stest.Parent@1c7865b)
[EL Fine]: 2008.07.17 08:09:32.721--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--INSERT IGNORE INTO CHILD
(VERSION, CREATEDON, PARENT_ID) VALUES (?, ?, ?)
bind => [1, 2008-07-17 08:09:32.721, 1]
[EL Finest]: 2008.07.17 08:09:32.721--ClientSession(18206828)--Thread(Thread[main,5, main])--Execute query ValueReadQuery()
[EL Fine]: 2008.07.17 08:09:32.721--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--values
IDENTITY_VAL_LOCAL()
[EL Finest]: 2008.07.17 08:09:32.721--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--assign sequence to the object (4 ->
stest.Child@1700391)
[EL Finer]: 2008.07.17 08:09:32.721--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--begin unit of work commit
[EL Finer]: 2008.07.17 08:09:32.721--ClientSession(18206828)--Connection(14452459)- -Thread(Thread[main,5,main])--commit transaction
[EL Finer]: 2008.07.17 08:09:32.737--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--end unit of work commit
[EL Finer]: 2008.07.17 08:09:32.737--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--resume unit of work
[EL Finer]: 2008.07.17 08:09:32.737--UnitOfWork(4573563)--Thread(Thread[main,5,main ])--release unit of work
[EL Finer]: 2008.07.17 08:09:32.737--ClientSession(18206828)--Thread(Thread[main,5, main])--client released
[EL Finest]: 2008.07.17 08:09:32.737--ServerSession(26435810)--Thread(Thread[main,5, main])--Begin predeploying Persistence Unit
stestPU; state Deployed; factoryCount 1
[EL Finest]: 2008.07.17 08:09:32.737--ServerSession(26435810)--Thread(Thread[main,5, main])--End predeploying Persistence Unit
stestPU; state Deployed; factoryCount 2
[EL Finest]: 2008.07.17 08:09:32.737--ServerSession(26435810)--Thread(Thread[main,5, main])--Begin deploying Persistence Unit
stestPU; state Deployed; factoryCount 2
[EL Finest]: 2008.07.17 08:09:32.737--ServerSession(26435810)--Thread(Thread[main,5, main])--End deploying Persistence Unit stestPU;
state Deployed; factoryCount 2
[EL Finer]: 2008.07.17 08:09:32.737--ServerSession(26435810)--Thread(Thread[main,5, main])--client acquired
[EL Finest]: 2008.07.17 08:09:32.737--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--Execute query ReadObjectQuery(stest.Parent)
[EL Finest]: 2008.07.17 08:09:32.737--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--Register the existing object stest.Child@e99ce5
[EL Finest]: 2008.07.17 08:09:32.737--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--Register the existing object
stest.Parent@186dda3
[EL Finest]: 2008.07.17 08:09:32.737--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--Register the existing object stest.Child@510e39
[EL Finest]: 2008.07.17 08:09:32.737--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--Register the existing object
stest.Parent@186dda3
[EL Finest]: 2008.07.17 08:09:32.737--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--Register the existing object
stest.Child@164debb
[EL Finest]: 2008.07.17 08:09:32.737--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--Register the existing object
stest.Parent@186dda3
Child 3 present
Child 1 present
Child 2 present
config set count is 3
[EL Finer]: 2008.07.17 08:09:32.752--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--begin unit of work commit
[EL Finer]: 2008.07.17 08:09:32.752--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--end unit of work commit
[EL Finer]: 2008.07.17 08:09:32.752--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--resume unit of work
[EL Finer]: 2008.07.17 08:09:32.752--UnitOfWork(19902639)--Thread(Thread[main,5,mai n])--release unit of work
[EL Finer]: 2008.07.17 08:09:32.752--ClientSession(22562823)--Thread(Thread[main,5, main])--client released
BUILD SUCCESSFUL (total time: 14 seconds)


James wrote:
> Very odd issue.
>
> If removing the version or serialNumber makes the issue go away, it
> sounds like your commit must be failing somehow (or perhaps the merge).
> Ensure that you do not get any errors in any of the flush or the commit.
>
> In you test code the find for the parent should return the identical
> object in each case, verify that the find return is == p0. Also try
> removing the flushes to see if they issue goes away.
>
> Your could is using application managed entity managers and
> transactions. Ensure that you are not using a JTA DataSource.
>
> Also enable logging to finest and include the log.
>
> -- James
>
Previous Topic:Problems with sequences
Next Topic:JPA Query generate uppercase field names
Goto Forum:
  


Current Time: Thu Apr 25 00:19:16 GMT 2024

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

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

Back to the top