
|
If you were logged in you would be able to see more operations.
|
|
EJB Cartridge
Created: 24/Jul/07 11:13 AM
Updated: 15/Feb/08 09:08 AM
|
|
| Component/s: |
None
|
| Affects Version/s: |
None
|
| Fix Version/s: |
None
|
|
Mapping a composite PK using <<Identifier>> stereotype somehow breaks creation of <<ValueObject>>, since every field having the <<Identifier>> stereotype is created inside a PK embedded object, so the Entity-To-ValueObject conversion template cannot locate it.
Example :
<<Entity>>
Person
<<Identifier>> +id : Long
<<Identifier>> +tag : String
||
||
||
\/
<<ValueObject>>
PersonVO
+id : Long
+tag : String
throws a "cannot find symbol : method getId() ... cannot find symbol : method getTag()"
in class PersonDaoBase :
public void toPersonVO(Person source, PersonVO target)
...
target.setId(source.getId());
target.setTag(source.getTag());
}
these field are in fact generated inside PersonPK, so code should be like this :
public void toPersonVO(Person source, PersonVO target)
...
target.setId(source.getPk().getId());
target.setTag(source.getPk().getTag());
}
This forum topic is about the same problem: http://galaxy.andromda.org/forum/viewtopic.php?t=4937
|
|
Fix applied in cvs.
Looks as if there is now a new bug.
For each property, there is a converter method creates as
target.setXyz(source.getPk().getXyz());
Regardless of whether the property is a identifier or not!
Take the example above:
<<Entity>>
Person
<<Identifier>> +id : Long
<<Identifier>> +tag : String
+name : String
||
V
<<ValueObject>>
PersonVO
+id : Long
+tag : String
+name : String
the cartridge generate the following method:
public void toPersonVO(Person source, PersonVO target)
...
target.setId(source.getPk().getId()); //OK!
target.setTag(source.getPk().getTag()); //OK!
target.setName(source.getPk().getName()); //FALSE!
}
|
|