openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "himakiran (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-673) Entity using Generated Value for primary key and a Version field and no DetachedStae fails to merge
Date Wed, 26 Nov 2008 14:02:44 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651002#action_12651002
] 

himakiran commented on OPENJPA-673:
-----------------------------------

Hi,
I got a similar issue, but when I am trying to insert records i.e., em.persist(bean);
I checked all the way, the primary key field is null, but it says the following exception.
Please help me out, struck up totally with this.
Thanks

<openjpa-1.0.1-r420667:592145 fatal user error> org.apache.openjpa.persistence.InvalidStateException:
The generated value processing detected an existing value assigned to this field: com.bipt.tiva.persistance.entity.AdditionalInterest.riskAiId.
 This existing value was either provided via an initializer or by calling the setter method.
 You either need to remove the @GeneratedValue annotation or modify the code to remove the
initializer processing.
	at org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:446)
	at org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:426)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:541)
	at org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:134)
null
	at org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:501)
	at org.apache.openjpa.kernel.StateManagerImpl.assignField(StateManagerImpl.java:590)
	at org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2772)
	at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
	at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:940)
	at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1892)
	at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1852)
	at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1623)
	at org.apache.openjpa.kernel.DelegatingBroker.flush(DelegatingBroker.java:973)
	at org.apache.openjpa.persistence.EntityManagerImpl.flush(EntityManagerImpl.java:488)
	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:585)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:194)
	at $Proxy6.flush(Unknown Source)
	at com.bipt.tiva.persistance.jpa.uw.cp.CpRiskDaoJpaImpl.save(CpRiskDaoJpaImpl.java:86)
	at com.bipt.tiva.persistance.jpa.uw.cp.CpRiskAiTest.testAddContent(CpRiskAiTest.java:703)
	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:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


> Entity using Generated Value for primary key and a Version field and no DetachedStae
fails to merge 
> ----------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-673
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-673
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Pinaki Poddar
>
> Entities using GeneratedValue for primary key, a version field an dno detached state
fails to merge.
> The issue lies with identifying :"what makes a new instance?"
> It is not obvious why VersionAttachStrategy does not use version field to detect newness.
Instead it depends on detached state which is obviously null for instances not using a Detached
State.
> Can someone shade some light on why VersionAttachStrategy ignores version field to detect
newness? 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message