[EJB 3.0] - How to map this?
by lafr
I'm migrating an EJB 2.1 application to EJB 3.0 using JBoss 4.2.2.GA.
Some question on how to map fields and relations.
Object message contains a message header, message parts and each message part contains message lines.
message head has a generated id.
message part has a composite pk build of message head id and part_no.
@Entity
| @Table(name="head")
| public class Head implements Serializable
| {
| @Id
| @GeneratedValue(strategy=GenerationType.IDENTITY)
| @Column(name="head_id")
| private Integer headId;
|
| @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
| @OrderBy("partNo")
| @JoinColumns({
| @JoinColumn(name="head_id",referencedColumnName="head_id")
| })
| private Collection<Part> parts = new ArrayList<Part>();
|
This gives me an Exception saying
Repeated column in mapping for entity: Head column: head_id (should be mapped with insert="false" update="false").
Is adding 'insert="false" update="false"' to the JoinColumn properties the right way to solve this duplicate field?
What about using Transient?
I get similar problems with ManyToOne relations.
Database table for Order has a field order_type.
This field is a FK to the OrderType table id.
But order_type in combination with output_type is a composite FK to OrderProperties.
So I would have in Order.java:
- a field of type Integer named orderType
- a field of type Integer named outputType
- a ManyToOne relation to EB OrderType with JoinColumn orderType
- a ManyToOne relation to EB OrderProperties with JoinColumns orderType and outputType
So three mappings for column order_type and two mapping for column output_type.
Should I omit the plain fields in this case and mark the JoinColumn orderType for OrderProperties with 'insert="false" update="false"' then?
Or what's the best practice for something like this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083184#4083184
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083184
18 years, 9 months
[JBoss jBPM] - sub-process invocation
by petia
Hi,
How do I invoke a sub-process from a main-process?
I am trying to invoke a sub-process (in jBPM 3.1.4) but I fail.
I have the following code in my main-process definition:
| <process-state name="sub1">
| <sub-process name="sequence"></sub-process>
| <transition name="" to="task2"></transition>
| </process-state>
|
I have a process called sequence which is defined in the same process library as the main-process and which is successfully deployed and tested.
The beginning of sequence/processdefinition.xml file looks like this:
| <process-definition
| xmlns="urn:jbpm.org:jpdl-3.1" name="sequence">
| ...
|
When I am trying to deploy the main-process I am getting the following error message. (If the sub-process invocation is excluded, the main-process deploys nicely.)
| java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/jbpm/upload
| at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
| at org.jbpm.ui.util.ProcessDeployer.deployProcessWithServlet(Unknown Source)
| at org.jbpm.ui.util.ProcessDeployer.access$3(Unknown Source)
| at org.jbpm.ui.util.ProcessDeployer$1.run(Unknown Source)
| at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)
| at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)
| at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:479)
| at org.jbpm.ui.util.ProcessDeployer.showProgressMonitorDialog(Unknown Source)
| at org.jbpm.ui.util.ProcessDeployer.deploy(Unknown Source)
| at org.jbpm.ui.editor.form.deployment.DeploymentForm$1.widgetSelected(Unknown Source)
| at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
| at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
| at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
| at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
| at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
| at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
| at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
| at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
| at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
| at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
| at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
| at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
| at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
| at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
| at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
| at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
| at org.eclipse.core.launcher.Main.run(Main.java:977)
| at org.eclipse.core.launcher.Main.main(Main.java:952)
|
It seems that I do not refer to the sub-process properly. I have tried to find more information about how to do this on this forum and in the documentation, but I have not succeed to find out how to do.
Help is appreciated. Thanks for taking your time.
Kind regards, Petia
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083182#4083182
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083182
18 years, 9 months