Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] duplicate assignments to same column in update

Thanks for asking that.  I didn't think to try repeated running in the
same deployment run..

From a quick handful of tests, it does appear that for a particular
"run", all attempts either succeeds, or all attempts fail.

Without knowing much of how EclipseLink works under the hood, it does
seem to me that the problem occurs when the meta-model is first being
created.  It does very much feel that the multiple embedded Money
relationships is the culprit -- there are other classes in the project
with two embedded Money members - they all appear to work fine.  This
is the only one that has three of these Money entities.



On Tue, Oct 19, 2010 at 9:42 AM, James Sutherland <jamesssss@xxxxxxxxx> wrote:
>
> Very odd,
>  When the error occurs, does it always occur for that same deployment, or
> does it sometimes fail, sometimes pass with the same run?
>  I assume it is related to association overrides and the multiple Embedded
> Money relationships.  If you comment out these in tern, does the issue go
> away?
>
>
> Joseph Chiu-2 wrote:
>>
>> Hi,
>>
>>
>>
>> I am having a problem which I think might be happening inside
>> EclipseLink.  Between multiple runs of the same test program, the
>> program (which is deterministic) will randomly pass or fail.  When the
>> program passes, the databse result is as expected.  When it fails, the
>> error is always the same: an update error where there are multiple
>> assignments to the same column. (Error message and code fragments
>> pasted below).
>>
>> I am still relatively new to EL and JPA, and am not sure how to
>> proceed at this point.  I tried to look through bugs.eclipse.org, and
>> have searched for a couple days now, but am still completely stuck.
>> Thanks in advance for any help or guidance!
>>
>> Joseph
>>
>>
>>
>> I am running EL 2.0.0 against Postgresql 8.3.  I have tried EL 2.1.1
>> and get the same result.
>>
>> My Money class is @Embeddable:
>>
>> @Embeddable @Access(AccessType.FIELD)
>> public class Money extends Object implements Comparable<Money> {
>> [...]
>>  @Column (nullable = false, precision=12, scale=3,
>> columnDefinition="DECIMAL(12,2)")
>>  protected BigDecimal amount;
>>
>>  @Column (nullable = false, columnDefinition="CHAR(3)")
>>  protected String denomination;
>> [...]
>>
>>
>>
>> And I use that in the CampaignResult class:
>> @Entity
>> public class CampaignResult {
>>  @Id
>>  @GeneratedValue(strategy = GenerationType.IDENTITY)
>>  private int id;
>>
>>  @OneToOne(optional = false, fetch = FetchType.LAZY, cascade =
>> CascadeType.ALL)
>>  private Campaign campaign;
>>  @Version
>>  private Timestamp lastUpdated;
>> [...]
>>  @AttributeOverrides({
>>   @AttributeOverride(name="amount", column=@Column(name="ACTUAL_VALUE")),
>>   @AttributeOverride(name="denomination",
>> column=@Column(name="ACTUAL_VALUE_DENOMINATION"))})
>>  private Money actualValue;
>>
>>  @AttributeOverrides({
>>   @AttributeOverride(name="amount",
>> column=@Column(name="REPORTED_VALUE")),
>>   @AttributeOverride(name="denomination",
>> column=@Column(name="REPORTED_VALUE_DENOMINATION"))})
>>  private Money reportedValue;
>>  @AttributeOverrides({
>>   @AttributeOverride(name="amount", column=@Column(name="CHARGED_VALUE")),
>>   @AttributeOverride(name="denomination",
>> column=@Column(name="CHARGED_VALUE_DENOMINATION"))})
>>  private Money chargedValue;
>> [...]
>>
>>
>>
>> It is when I update the chagedValue member and persist to the database
>> that I get the multiple assignments to the same CHARGED_VALUE column:
>>
>> [EL Warning]: 2010-10-08
>> 13:14:45.535--UnitOfWork(3431235)--Thread(Thread[pool-1-thread-1,5,main])--Local
>> Exception Stack:
>>
>> Exception [EclipseLink-4002] (Eclipse Persistence Services -
>> 2.1.1.v20100817-r8050):
>> org.eclipse.persistence.exceptions.DatabaseException
>>
>> Internal Exception: org.postgresql.util.PSQLException: ERROR: multiple
>> assignments to same column "charged_value"
>>
>> Error Code: 0
>>
>> Call: UPDATE CAMPAIGNRESULT SET CHARGED_VALUE = ?, CHARGED_VALUE = ?,
>> LASTUPDATED = ? WHERE ((ID = ?) AND (LASTUPDATED = ?))
>>
>>                 bind => [2.93, 2.93, 2010-10-08 13:14:45.523302, 1659,
>> 2010-10-08 13:14:45.351123]
>>
>> Query:
>> UpdateObjectQuery(com.me.modules.advertiser.domain.CampaignResult@182c132)
>>
>>                 at
>> org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
>>
>>                 at
>> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1419)
>>
>>                 at
>> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:795)
>>
>>                 at
>> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:863)
>>
>>                 at
>> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:583)
>>
>>                 at
>> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:526)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.AbstractSession.executeCall(AbstractSession.java:980)
>>
>>                 at
>> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:206)
>>
>>                 at
>> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:192)
>>
>>                 at
>> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.updateObject(DatasourceCallQueryMechanism.java:747)
>>
>>                 at
>> org.eclipse.persistence.internal.queries.StatementQueryMechanism.updateObject(StatementQueryMechanism.java:430)
>>
>>                 at
>> org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1144)
>>
>>                 at
>> org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84)
>>
>>                 at
>> org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:290)
>>
>>                 at
>> org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
>>
>>                 at
>> org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:736)
>>
>>                 at
>> org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:643)
>>
>>                 at
>> org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
>>
>>                 at
>> org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2909)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1291)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1273)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1233)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:265)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:190)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:136)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3348)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1422)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:546)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1568)
>>
>>                 at
>> org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:359)
>>
>>                 at
>> org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:741)
>>
>>                 at
>> com.tweetup.modules.advertiser.domain.repository.impl.AccountingProviderImpl.chargeAccountForDate(AccountingProviderImpl.java:168)
>>
>>                 at
>> com.tweetup.modules.advertiser.domain.repository.impl.AccountingProviderTest.testCompleteBilling(AccountingProviderTest.java:305)
>>
>>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>
>>                 at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>>                 at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>>                 at java.lang.reflect.Method.invoke(Method.java:597)
>>
>>                 at
>> org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:640)
>>
>>                 at
>> org.testng.internal.Invoker.invokeMethod(Invoker.java:627)
>>
>>                 at
>> org.testng.internal.Invoker.invokeTestMethod(Invoker.java:799)
>>
>>                 at
>> org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1103)
>>
>>                 at
>> org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
>>
>>                 at
>> org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
>>
>>                 at org.testng.TestRunner.runWorkers(TestRunner.java:1098)
>>
>>                 at org.testng.TestRunner.privateRun(TestRunner.java:727)
>>
>>                 at org.testng.TestRunner.run(TestRunner.java:581)
>>
>>                 at org.testng.SuiteRunner.runTest(SuiteRunner.java:315)
>>
>>                 at
>> org.testng.SuiteRunner.runSequentially(SuiteRunner.java:310)
>>
>>                 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:272)
>>
>>                 at org.testng.SuiteRunner.run(SuiteRunner.java:221)
>>
>>                 at
>> org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:40)
>>
>>                 at
>> org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
>>
>>                 at
>> org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:151)
>>
>>                 at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>
>>                 at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>
>>                 at java.lang.Thread.run(Thread.java:619)
>>
>>
>>
>
>
> -----
> http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
> http://www.eclipse.org/eclipselink/
>  EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
> TopLink
> Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink ,
> http://wiki.oracle.com/page/TopLink TopLink
> Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
> http://www.nabble.com/EclipseLink-f26430.html EclipseLink
> Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
> --
> View this message in context: http://old.nabble.com/duplicate-assignments-to-same-column-in-update-tp29919049p30002066.html
> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>


Back to the top