[Persistence, JBoss/CMP, Hibernate, Database] - NULL FOREIGN KEY
by pvelarde
Hi all,
I've got a master-detail relation mapped with these two simple EJB3.0 beans below; when I modify master record, the detail records lose the join with master so masterid is set to null in detail table.
I don't want any cascade efect so CASCADETYPE is not established in master.
I've read something about this problem in forus but have no solution. Is this an Hibernate bug¿? have any idea ¿?
thanks for your help.
MASTER BEAN CODE
@Entity
| @Table(name = "master")
| @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
| public class MasterEJB implements Serializable {
|
| ...
|
| protected Collection<DetailEJB> details = new Vector<DetailEJB>();
|
| @OneToMany(targetEntity = DetailEJB.class)
| @JoinColumn(name="master_id")
| public Collection<DetailEJB> getDetails() {
| return details;
| }
|
| public void setDetails(Collection<DetailEJB> details) {
| this.details = details;
| }
|
| ...
|
DETAIL BEAN CODE
@Entity
| @Table(name = "detail")
| @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
| public class DetailEJB implements Serializable {
|
| ...
|
| @ManyToOne(optional=false)
| @JoinColumn(name="master_id", nullable=false)
| public Integer getMasterID() {
| return masterid;
| }
|
| public void setMasterID(Integer masterid) {
| this.masterid = masterid;
| }
|
| ...
|
Each bean has its own table on a MySQL DBMS, here are master and detail tables definitions:
CREATE TABLE `master` (
| `id` int(11) NOT NULL auto_increment,
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB
|
| CREATE TABLE `detail` (
| `id` int(11) NOT NULL auto_increment,
| `master_id` int(11) default '0',
| PRIMARY KEY (`id`),
| KEY `FK30E0AFBF496DF04C` (`master_id`)
| ) ENGINE=InnoDB
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4092982#4092982
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4092982
18Â years, 7Â months
[JBoss jBPM] - Delegation Class Problems (Repost)
by Tom Brough
I have desgined a very small workflow using eclipse. I have incorporated an assignment class to delegate a task to a particular user. All micky mouse stuff but I am getting the following in JBOSS log
ERROR [Delegation] couldn't load delegation class ''
and this from the web page :-
Error starting process: An exception of type "org.jbpm.graph.def.DelegationException" was thrown.
Now this is my processdefinition.xml
| <?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition
| xmlns="urn:jbpm.org:jpdl-3.2"
| name="IT01">
| <swimlane name="initiator">
| <assignment class=""></assignment>
| </swimlane>
| <swimlane name="ITManager">
| <assignment class=""></assignment>
| </swimlane>
| <start-state name="start">
| <transition name="transition1" to="getDetails"></transition>
| </start-state>
| <end-state name="end"></end-state>
| <task-node name="getDetails">
| <task name="getDetails" swimlane="initiator"></task>
| <transition name="Transition2" to="Check Form">
| </transition>
| </task-node>
| <task-node name="Check Form">
| <task name="ITManagerFormCheck">
| <assignment class="uk.gov.torbay.it01.jbpm.ITManagerAssignment">
| <actor>manager</actor>
| </assignment>
| </task>
| <transition name="Transition3" to="end"></transition>
| </task-node>
| </process-definition>
and this is the source of my uk.gov.torbay.it01.jbpm.ITManager Assignment class.
| package uk.gov.torbay.it01.jbpm;
|
| import org.jbpm.graph.exe.*;
| import org.jbpm.taskmgmt.def.*;
| import org.jbpm.taskmgmt.exe.Assignable;
|
| public class ITManagerAssignment implements AssignmentHandler {
|
| private static final long serialVersionUID = 1L;
|
| private String actor;
|
| public ITManagerAssignment()
| {
| }
| public void assign(Assignable assignable, ExecutionContext executionContext) {
| assignable.setActorId("manager");
| }
| public String getActor() {
| return actor;
| }
| public void setActor(String actor) {
| this.actor = actor;
| }
|
| }
|
>From the above error It would appear I have a parsing problem with the processdefinition.xml file since it seems to be trying to load a null class path/name.
Anyone got any ideas where I am going wrong here ?
The Eclipse deploy seems to indicate everything is ok so I am not sure whate to believe here.
Appologies for repost I quoted the code instead of coding it and it didnt like it, price you pay for not previewing things in the first place.
Tom.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4092973#4092973
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4092973
18Â years, 7Â months