Sorry to reopen this thread,
I've played around with the solution. It works well with em.persist but it produces a java.lang.StackOverflowError for em.merge.
Please find below a snippet of the stack trace:
Code:
16:32:56,796 DEBUG SocketWrapper:123 - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=2822].107ebe1] closing
javax.ejb.EJBException: java.lang.RuntimeException: java.lang.StackOverflowError
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
I'm not really sure what's the problem.
[/code]
Right now the mappings are:
Code:
Parent class
========
@Id
@GeneratedValue(strategy = SEQUENCE, generator = "seq_idP")
private long idP;
@OneToMany(mappedBy = "pk.idPChildren", cascade = { CascadeType.ALL }, fetch = EAGER)
private List<Children> childrenCollection;
Children class
=========
@EmbeddedId
private ChildrenPK pk;
PK Class
======
@ManyToOne
@JoinColumn(name = "idP", referencedColumnName = "idP")
private Parent idPChildren;
private long line;
I've looked trough some of the posts in this forum but couldn't find any to match my problem.
Thanks for all your help