Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.0
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Be gentle with me as I am new, have read the docs and just need clarification.
I have an object: Run this object has a number of params to include several other objects. One of those I call Status. I have a get and set for the status in the Run.java. I define the fields in the Run.hbm.java with <many-to-one name="status" column="stausID" cascade="all"/>
I get a bit confused on the many naming so what I want is that A run has A status but that Status may belong to many other runs. In the Run.java I am trying to add the status like this:
public void addStatus(Status statusObj)
{
this.getStatus().add(statusObj);
}
In my business method:
I do:
Run run = new Run();
Status status = new Status();
status.setStatus("NONE");
run.addStatus(status);
I can't compile b/c if can not resolve the this.getStatus().add(..); Am I traveling down the right path here? What am I missing? I can't find where the method .add() is defined? I found this in an example and it is not explicitly defined anywhere there either. I thought it might be a Java method but can't seem to find one for the Object class? Any help?
On a side note, is there a better way to do this? I have a number of instances where this scenario occur. I have objects with relationships to other objects. Thanks.
Full stack trace of any exception that occurs:
Can't resolve: this.getStatus().add(statusObj);
Name and version of the database you are using:
Sybase ASE 12.5.5
Debug level Hibernate log excerpt:
DEBUG