Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink @TableGenerator Concurrency Issue(EclipseLink @TableGenerator does not work properly in Concurrent thread)
EclipseLink @TableGenerator Concurrency Issue [message #1771598] Mon, 28 August 2017 13:18 Go to next message
Akhilesh  Tripathi is currently offline Akhilesh TripathiFriend
Messages: 2
Registered: August 2017
Junior Member
I am using @TableGenerator to create primary id key sequences.

@Entity
@Table(name="PK_EVENT")
sequenceName="PK_EVT_SEQ")
@TableGenerator(
name="EVENTGEN",
table="PK_ID_GENERATOR",
pkColumnName="ID_KEY",
pkColumnValue="EVENT_ID",
valueColumnName="ID_VALUE",
allocationSize=1)

public class EventEntity implements Serializable,FDMSEntity
{
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy=GenerationType.TABLE, generator="EVENTGEN")
generator="EVENTGEN")
@Column(name="EVENT_ID")
private long _eventId;
public long getEventId()
{
return _eventId;
}
public void setEventId(long p_eventId)
{
_eventId = p_eventId;
}

I have created "PKDS" as data source Weblogic 12c for connecting to SYBASE database. Created to persistence-unit PKDS-LOCAL type Resource_LOCAL & PKDS-JTA (type JTA)
"PKDS" data source is commanly shared between both persistence-units.

Now when I am running my multithreaded application. First I am issuing 'ERROR log event' to persist into PK_EVENT table using JTA txn, and immediately issuing 'INFO log event' to persist into PK_EVENT table using RESOURCE_LOCAL txn. then application waits untill JTA timeout time and return Error saying "message: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.sybase.jdbc3.jdbc.SybSQLException: Attempt to insert duplicate key row in object 'PK_EVENT' with unique index 'PK_EVENT_PK'

Error Code: 2601
Call: INSERT INTO PK_EVENT (EVENT_ID, DIRECTION, EVENT_MSG, EVENT_TIME, EVENT_TYPE, LINE_ID) VALUES (?, ?, ?, ?, ?, ?)
bind => [6 parameters bound]
Query: InsertObjectQuery(com.entity.EventEntity@7601127b)".
When I Check PK_EVENT table I see that INFO message of RESOURCE_LOCAL txn is persisted but error occurred for JTA txn which was issued first.

Please Help with possible way of resolution.

Thanks.
Re: EclipseLink @TableGenerator Concurrency Issue [message #1771684 is a reply to message #1771598] Tue, 29 August 2017 13:58 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1275
Registered: July 2009
Senior Member
Duplicate of https://www.eclipse.org/forums/index.php/t/1088516/
Previous Topic:EclipseLink @TableGenerator Concurrency Issue
Next Topic:Getting hung threads in Eclipselink 2.6.4
Goto Forum:
  


Current Time: Thu Dec 14 13:28:12 GMT 2017

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

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