Solved: It was the definition of the equals function in the hibernate beans.
Am 14.04.2014 10:29, schrieb Yahoo:
I got a step further with the following definitions
I succeded to Insert the ManyToOne relationships.
Only the DropDownChoices don't write the changes back in the Model:
In the hybernate model:
@ManyToOne(cascade = CascadeType.REFRESH,fetch=FetchType.EAGER)
@JoinColumn(name="ObKeinKontakt",nullable=false)
public Objektsuch getObjektsuch(){
return this.objektsuch;
}
@ManyToOne(cascade = CascadeType.REFRESH,fetch=FetchType.EAGER)
@JoinColumn(name="ObjArtID",nullable=false)
public Objektart getObjektart(){
return this.objektart;
}
In the wicket form:
IChoiceRenderer<Objektsuch> objektsuchchoicerenderer= new
IChoiceRenderer<Objektsuch>() {
public Object getDisplayValue(Objektsuch objektsuch)
{
return objektsuch.getSuchtext()+" "+objektsuch.getId();
}
public String getIdValue(Objektsuch object,int index)
{
return object.getId().toString();
}
};
IChoiceRenderer<Objektart> objektartchoicerenderer= new
IChoiceRenderer<Objektart>() {
public Object getDisplayValue(Objektart objektart)
{
return objektart.getObjartname()+" "+objektart.getId();
}
public String getIdValue(Objektart object,int index)
{
return object.getId().toString();
}
};
IModel<List<? extends Objektsuch>> makeChoicesObjektsuch = new
AbstractReadOnlyModel<List<? extends Objektsuch>>()
{
@Override
public List<Objektsuch> getObject()
{ List<Objektsuch> objektsuchlist=new
ArrayList<Objektsuch>();
Iterator
objektsuchiterator=objektsuchManager.getObjektsuchen().iterator();
while(objektsuchiterator.hasNext()){
Objektsuch
objektsuch=(Objektsuch)objektsuchiterator.next();
objektsuchlist.add(objektsuch);
}
return objektsuchlist;
}
};
IModel<List<? extends Objektart>> makeChoicesObjektart =
new AbstractReadOnlyModel<List<? extends Objektart>>()
{
@Override
public List<Objektart> getObject()
{ List<Objektart> objektartlist=new
ArrayList<Objektart>();
Iterator
objektartiterator=objektartManager.getObjektartes().iterator();
while(objektartiterator.hasNext()){
Objektart
objektart=(Objektart)objektartiterator.next();
objektartlist.add(objektart);
}
return objektartlist;
}
};
final DropDownChoice<Objektsuch> obkeinkontakt = new
DropDownChoice<Objektsuch>("objektsuch",
makeChoicesObjektsuch,objektsuchchoicerenderer);
add(obkeinkontakt);
final DropDownChoice<Objektart> objektart = new
DropDownChoice<Objektart>("objektart",
makeChoicesObjektart,objektartchoicerenderer);
add(objektart);
Am 14.04.2014 09:39, schrieb Yahoo:
I serarated the hibernate part in an own maven modul.
I the tests in this modul everything works well.
I use a lot of many to one relationships.
In the web application I get sometimes problems, that
the key of a many to one relationship is not written
or the DropDownChoice does'nt write the change in the model.
Generally I am disappointed by the abstraction hibernate gives me in
the application.
There are a lot of cases where you are torn in the specialities of
how hibernate works in a web application.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org