Problem with the EntityManager and persist
Hello,
I wrote a entity bean with generatedValue for ID. I can save the entity in the database with the EntityManager and the method persist. But if I save the object with the persist method, I didn't get the reference with the new ID back to the client...
I print the object in the application Server (JBoss) and the object is correct with values and generated ID. But in the client I have the same old object without ID.
Can somebody help me? I commit the method the reference but I never get the current object...
Here the Client invoke:
NewsVO news2 =new NewsVO("Peter Pan",new Date(),"躡erschriften wtf","Hier steht irgendwann Inhalt");
verwaltung.saveNews(news2);
System.out.println(news2);
Here the console output:
NEWSBEAN [ID=null] [AUTHOR=Peter Pan] [ERSTELLT_AM=Wed May 23 14:25:52 CEST 2007] [UEBERSCHRIFT=躡erschriften wtf] [INHALT=Hier steht irgendwann Inhalt]
Now the Remote Object:
publicvoid saveNews(NewsVO news){
if(news !=null){
try{
manager.persist(news);
log.info("News would be saved.\t\t\n" + news);
}catch(Exception ex){
log.error("Could not save News.\t\t\n" + news);
ex.printStackTrace();
}
}
}
In the application server the news object would be printed correctly:
14:30:55,021 INFO [NewsVerwaltung] News would be saved.
NEWSBEAN [ID=1] [AUTHOR=Peter Pan] [ERSTELLT_AM=Wed May 23 14:30:54 CEST 2007] [UEBERSCHRIFT=▄berschriften wtf] [INHALT=Hier steht irgendwann Inhalt]
Anybody a idea how I get the current instance with the ID from the object?

