openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From du27177 <metala...@yahoo.com>
Subject Problem with insert
Date Mon, 16 Jun 2008 13:18:42 GMT

Hi.
I got problem with inserting in tables with equals primary key ID. Database
generate that ID.
example:
MAIN_TABLE SUBTABLE
id--------- = id
name1 param
name1 ...
...

Main Table:
@Entity
@Table(name = "MAIN_TABLE", schema = "SCH")
@Inheritance(strategy=InheritanceType.JOINED)
public class MainClass extends SuperClass {

@Id
@Column(insertable = false)
@GeneratedValue(strategy=GenerationType.IDENTITY)
public Integer id;
public Integer getId() {
return id;
}

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

}
-----------------
Subtable
@Entity
@Embeddable
@Table(name = "SUBTABLE", schema = "SCH")
@PrimaryKeyJoinColumn(name="ID")
public class SubtableClass extends MainClass {
@Column(name = "param", length = 16)
public String param;
...
}
--------------


....
MainClass mc = new MainClass();
mc.setName1("name1");
EntityManager em = null;
...// Inset into MAIN_TABLE and it is OK
try {
mc = em.merge(mc);
em.flush();
} finally {
if (em != null) {
em.close();
}
}

// INSERT INTO SUBTABLE
SubtableClass sc = new SubtableClass();
sc.setId(mc.getId());
try {
sc = em.merge(sc);
em.flush();
} finally {
if (em != null) {
em.close();
}
}

The Error is:
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R
<openjpa-1.0.2-r420667:627158 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: null
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3167)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
MyClassTest.InsertIntoTables(InsertIntoTables.java:66)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
java.lang.reflect.Method.invoke(Method.java:618)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter$2.run(JavaReflectionAdapter.java:152)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
java.security.AccessController.doPrivileged(AccessController.java:197)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter.invoke(JavaReflectionAdapter.java:149)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.invokeSync(JavaImplementationHandler.java:447)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.processMessage(JavaImplementationHandler.java:195)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(MessageDispatcherImpl.java:714)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:1166)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(ManagedMessageImpl.java:821)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processUOWMessage(ModuleSessionBean.java:338)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.transactionRequiredActivitySessionNotSupported(ModuleSessionBean.java:311)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.transactionRequiredActivitySessionNotSupported(EJSLocalStatelessModule_43132892.java:233)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.uow.handler.UOWStrategyImpl.transactionGlobalActivitySessionFalse(UOWStrategyImpl.java:311)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.uow.handler.JoinUOWHandler.processMessage(JoinUOWHandler.java:165)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(MessageDispatcherImpl.java:725)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:1166)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(ManagedMessageImpl.java:812)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processMessage(ModuleSessionBean.java:149)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.processMessage(EJSLocalStatelessModule_43132892.java:97)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.invocation.impl.AdhocInvoker.processMessage(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.invocation.impl.Invoker.managedInvoke(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.invocation.impl.Invoker.invoke(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.invocation.impl.BaseInvocationHandler.invoke(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.doInvoke(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager$1.run(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
java.security.AccessController.doPrivileged(AccessController.java:219)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
javax.security.auth.Subject.doAs(Subject.java:495)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:118)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.invoke(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.command.impl.BaseInteractiveEventHandler.processEvent(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.command.impl.BaseCommandHandler.doCommand(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
Source)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.servlet.TestControllerServlet.process(TestControllerServlet.java:76)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.wbit.comptest.servlet.TestControllerServlet.doPost(TestControllerServlet.java:51)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:995)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:501)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1455)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:113)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:263)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R Caused by:
java.lang.NullPointerException
at
org.apache.openjpa.kernel.StateManagerImpl.loadField(StateManagerImpl.java:2932)
at
org.apache.openjpa.kernel.StateManagerImpl.fetchStringField(StateManagerImpl.java:2257)
at
org.apache.openjpa.kernel.AttachStrategy.attachField(AttachStrategy.java:157)
at
org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:164)
at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
at
org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
at
org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
at MyClassTest.InsertIntoTables(InsertIntoTables.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at
com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter$2.run(JavaReflectionAdapter.java:152)
at java.security.AccessController.doPrivileged(AccessController.java:197)
at
com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter.invoke(JavaReflectionAdapter.java:149)
at
com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.invokeSync(JavaImplementationHandler.java:447)
at
com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.processMessage(JavaImplementationHandler.java:195)
at
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(MessageDispatcherImpl.java:714)
at
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:1166)
at
com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(ManagedMessageImpl.java:821)
at
com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processUOWMessage(ModuleSessionBean.java:338)
at
com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.transactionRequiredActivitySessionNotSupported(ModuleSessionBean.java:311)
at
com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.transactionRequiredActivitySessionNotSupported(EJSLocalStatelessModule_43132892.java:233)
at
com.ibm.ws.sca.internal.uow.handler.UOWStrategyImpl.transactionGlobalActivitySessionFalse(UOWStrategyImpl.java:311)
at
com.ibm.ws.sca.internal.uow.handler.JoinUOWHandler.processMessage(JoinUOWHandler.java:165)
at
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(MessageDispatcherImpl.java:725)
at
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:1166)
at
com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(ManagedMessageImpl.java:812)
at
com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processMessage(ModuleSessionBean.java:149)
at
com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.processMessage(EJSLocalStatelessModule_43132892.java:97)
at
com.ibm.wbit.comptest.controller.invocation.impl.AdhocInvoker.processMessage(Unknown
Source)
at
com.ibm.wbit.comptest.controller.invocation.impl.Invoker.managedInvoke(Unknown
Source)
at com.ibm.wbit.comptest.controller.invocation.impl.Invoker.invoke(Unknown
Source)
at
com.ibm.wbit.comptest.controller.invocation.impl.BaseInvocationHandler.invoke(Unknown
Source)
at
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.doInvoke(Unknown
Source)
at
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager$1.run(Unknown
Source)
at java.security.AccessController.doPrivileged(AccessController.java:219)
at javax.security.auth.Subject.doAs(Subject.java:495)
at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:118)
at
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.invoke(Unknown
Source)
at
com.ibm.wbit.comptest.controller.command.impl.BaseInteractiveEventHandler.processEvent(Unknown
Source)
at
com.ibm.wbit.comptest.controller.command.impl.BaseCommandHandler.doCommand(Unknown
Source)
at
com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
Source)
at
com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
Source)
at
com.ibm.wbit.comptest.servlet.TestControllerServlet.process(TestControllerServlet.java:76)
at
com.ibm.wbit.comptest.servlet.TestControllerServlet.doPost(TestControllerServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:995)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:501)
at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1455)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:113)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:263)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)

[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.kernel.StateManagerImpl.loadField(StateManagerImpl.java:2932)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.kernel.StateManagerImpl.fetchStringField(StateManagerImpl.java:2257)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.kernel.AttachStrategy.attachField(AttachStrategy.java:157)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:164)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R at
org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
[2008.06.16 09:39:44:312 CEST] 00000086 SystemErr R ... 64 more 
-- 
View this message in context: http://www.nabble.com/Problem-with-insert-tp17864279p17864279.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Mime
View raw message