Message:
The following issue has been re-assigned.
Assignee: Max Rydahl Andersen (mailto:xa...@xa...)
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-387
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-387
Summary: hbm2java: addX(T x)/removeX(T x) methods generation in one-to-many relation class
Type: Improvement
Status: Assigned
Priority: Major
Project: Hibernate2
Components:
toolset
Versions:
2.0.3
Assignee: Max Rydahl Andersen
Reporter: venkat dosapati
Created: Wed, 8 Oct 2003 9:14 AM
Updated: Sun, 12 Oct 2003 12:33 PM
Description:
I was generating the java source files from mapping. I have two classes Workspace and Asset. Workspace-to-Asset is one-to-many association and Asset-to-Workspace is many-to-one association.
I did the required mapping for these 2 classes in my mapping file. But when I generate the classes the class 'Workspace' is not having the expected methods.
I was expecting 'addAsset(Asset)' & 'removeAsset(Asset)' methods in Workspace class. But the generated class 'Workspace' was not having them.
I feel Workspace class should have the following methods in addition to setAssets(List), getAssets():
public class Workspace {
private ArrayList assets;
public void addAsset(Asset _asset){
if(assets==null) assets=new ArrayList();
_asset.setWorkspace(this);
assets.add(_asset);
}
public void removeAsset(Asset _asset){
if(assets==null)return;
_asset.setWorkspace(null);
assets.remove(_asset);
}
}
I also feel it is better to have 'getAsset(Object assetId)' method in Workspace class in case of composition relation.
thanks
dosapati
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|