Re: Tapestry - hibernate problem
The session isn't closed until you are leaving the request, after your template has rendered. The problem is most likely with your query or your data. Try accessing the values from your component class and you should see that it's still null. You should also enable logging for hibernate to see exactly what it's loading and what query it's running. if you're using log4j.properties you can try these: log4j.category.org.hibernate.type=trace log4j.category.org.hibernate.cache=trace log4j.category.org.hibernate.SQL=debug and these to your hibernate properties. hibernate.show_sql=true hibernate.format_sql=true Josh On Sun, Dec 6, 2009 at 9:37 AM, blueboy6 wrote: > > My mapping are ok, because yesterday I used eager fetching on all collections > and it worked, I just removed every eager mappings and create criteria for > all one level criteria, problem is when I try to go deeper... > > It seams that problem is that session is closed when I try to fetch data... > It seeams that tapestry is closing hibernate sessions automatically. > > Someone told me to implement open session in view... Any suggestion about > that matter? > > Tnx for your fast answers :) > > > bouil wrote: >> >> Hi, >> >> You should check your mapping to be sure the many-to-one relationship >> between "comment" and "user" is correct, and verify your database table >> "comment" contains an existing foreign key to the user table. >> >> Best thing to do is to run your Criteria in a JUnit test. >> >> Nicolas. >> >> >> Bojan Cincur a écrit : >>> Hi all, >>> >>> I have a little problem. >>> >>> I'm using hibernate criteria to fetch list of objects that I want to >>> display >>> in loop component. (enclosed in my commentModule component) >>> >>> Criteria criteria = getManager().createCriteria(CommentBean.class); >>> criteria.setFetchMode("user",FetchMode.JOIN); >>> >>> this criteria should return list of commentBean objects and associated >>> user >>> object (as said in hibernate documentation), >>> >>> BUT >>> >>> when i call in loop element comment.user.username to optain username of >>> user >>> that posted comment I get this error: >>> >>> Render queue error in Expansion[PropBinding[expansion >>> collaborators/Details:commentsmodule(comment.user.username)]]: Property >>> 'user' (within property expression 'comment.user.username', of >>> me.xxx.xxx.components.commentsmod...@eaabad) is null. >>> >>> I tried all sorts of thing but I'm not sure what to do next... Is this >>> problem with tapestry and is there some sort of work around? >>> >>> >> >> >> >> >> > > -- > View this message in context: > http://old.nabble.com/Tapestry---hibernate-problem-tp2666p26667111.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry - hibernate problem
My mapping are ok, because yesterday I used eager fetching on all collections and it worked, I just removed every eager mappings and create criteria for all one level criteria, problem is when I try to go deeper... It seams that problem is that session is closed when I try to fetch data... It seeams that tapestry is closing hibernate sessions automatically. Someone told me to implement open session in view... Any suggestion about that matter? Tnx for your fast answers :) bouil wrote: > > Hi, > > You should check your mapping to be sure the many-to-one relationship > between "comment" and "user" is correct, and verify your database table > "comment" contains an existing foreign key to the user table. > > Best thing to do is to run your Criteria in a JUnit test. > > Nicolas. > > > Bojan Cincur a écrit : >> Hi all, >> >> I have a little problem. >> >> I'm using hibernate criteria to fetch list of objects that I want to >> display >> in loop component. (enclosed in my commentModule component) >> >> Criteria criteria = getManager().createCriteria(CommentBean.class); >> criteria.setFetchMode("user",FetchMode.JOIN); >> >> this criteria should return list of commentBean objects and associated >> user >> object (as said in hibernate documentation), >> >> BUT >> >> when i call in loop element comment.user.username to optain username of >> user >> that posted comment I get this error: >> >> Render queue error in Expansion[PropBinding[expansion >> collaborators/Details:commentsmodule(comment.user.username)]]: Property >> 'user' (within property expression 'comment.user.username', of >> me.xxx.xxx.components.commentsmod...@eaabad) is null. >> >> I tried all sorts of thing but I'm not sure what to do next... Is this >> problem with tapestry and is there some sort of work around? >> >> > > > > > -- View this message in context: http://old.nabble.com/Tapestry---hibernate-problem-tp2666p26667111.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry - hibernate problem
Hi, You should check your mapping to be sure the many-to-one relationship between "comment" and "user" is correct, and verify your database table "comment" contains an existing foreign key to the user table. Best thing to do is to run your Criteria in a JUnit test. Nicolas. Bojan Cincur a écrit : Hi all, I have a little problem. I'm using hibernate criteria to fetch list of objects that I want to display in loop component. (enclosed in my commentModule component) Criteria criteria = getManager().createCriteria(CommentBean.class); criteria.setFetchMode("user",FetchMode.JOIN); this criteria should return list of commentBean objects and associated user object (as said in hibernate documentation), BUT when i call in loop element comment.user.username to optain username of user that posted comment I get this error: Render queue error in Expansion[PropBinding[expansion collaborators/Details:commentsmodule(comment.user.username)]]: Property 'user' (within property expression 'comment.user.username', of me.xxx.xxx.components.commentsmod...@eaabad) is null. I tried all sorts of thing but I'm not sure what to do next... Is this problem with tapestry and is there some sort of work around? smime.p7s Description: S/MIME Cryptographic Signature
Re: Tapestry - hibernate problem
Hi, Looks more like an issue with your criteria. Have you tried to use FetchMode.EAGER instead? Christian Bojan Cincur schrieb: Hi all, I have a little problem. I'm using hibernate criteria to fetch list of objects that I want to display in loop component. (enclosed in my commentModule component) Criteria criteria = getManager().createCriteria(CommentBean.class); criteria.setFetchMode("user",FetchMode.JOIN); this criteria should return list of commentBean objects and associated user object (as said in hibernate documentation), BUT when i call in loop element comment.user.username to optain username of user that posted comment I get this error: Render queue error in Expansion[PropBinding[expansion collaborators/Details:commentsmodule(comment.user.username)]]: Property 'user' (within property expression 'comment.user.username', of me.xxx.xxx.components.commentsmod...@eaabad) is null. I tried all sorts of thing but I'm not sure what to do next... Is this problem with tapestry and is there some sort of work around? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Tapestry - hibernate problem
Hi all, I have a little problem. I'm using hibernate criteria to fetch list of objects that I want to display in loop component. (enclosed in my commentModule component) Criteria criteria = getManager().createCriteria(CommentBean.class); criteria.setFetchMode("user",FetchMode.JOIN); this criteria should return list of commentBean objects and associated user object (as said in hibernate documentation), BUT when i call in loop element comment.user.username to optain username of user that posted comment I get this error: Render queue error in Expansion[PropBinding[expansion collaborators/Details:commentsmodule(comment.user.username)]]: Property 'user' (within property expression 'comment.user.username', of me.xxx.xxx.components.commentsmod...@eaabad) is null. I tried all sorts of thing but I'm not sure what to do next... Is this problem with tapestry and is there some sort of work around? -- Bojan Ćinćur email blueb...@gmail.com Skype bojan.cincur
Re: T5: tapestry-hibernate problem when setting @Persist("entity") to a transient object
You're not doing anything wrong, per se. The exception is pretty clear: Only entities attached to a Hibernate Session can be persisted. If you go a step further, it turns out that only entities which have been previously committed to the db (ie: have a valid db id) can be persisted with @Persist("entity"). One possibility would be to file an "improvement" jira, suggesting that @Persist("entity") falls back to storing the entire object in the session if it is new (no dbid) or transient (not connected to a hibernate session). Otherwise, go back to using @Persist alone (which defaults to session), as it will work perfectly well for transient as well as non-transient objects, at the cost of increased memory use for the session. Robert On Aug 15, 2008, at 8/154:37 AM , buckofive wrote: Hi all, I am having some problems creating a simple crud with tapestry- hibernate 5.0.14. I followed the documentation and I have it mostly working. I can edit and save an existing entity with the @Persist("entity") annotation but if I try to create a new entity by setting the value to a newly instantiated entity I get this error: # org.apache.tapestry5.runtime.ComponentEventException Error persisting field PersistEntity:button: Failed persisting an entity in the session. Only entities attached to a Hibernate Session can be persisted. entity: [EMAIL PROTECTED] context eventType setToTransient # org.hibernate.TransientObjectException object references an unsaved transient instance - save the transient instance before flushing: com.roialte.entities.Button I figured I was doing something wrong so I copied the PersistEntity.tml and PersistEntity.java into my project from the tapestry-hibernate project. loaded the page and clicked the "set to transient" link and I got the same error. I am at a loss here as i cannot figure out what I'm doing wrong. How do u create a new entity for use within an edit page when using the @Persist('entity') annotation? I am using tapestry versions 5.0.14 and mysql 5.0 for my db. Any help is greatly appreciated. Thanks! here is a quick peek at my converted version of code from the tapesty-hibernate project: java: public class PersistEntity { @Persist("entity") @Property private Button button; @Inject private ButtonDAO ButtonDAO; @Inject private Session session; @Inject private HibernateSessionManager manager; void onCreateEntity() { Button button = new Button(); button.setName("name"); ButtonDAO.save(button); this.button = button; } void onChangeName() { button.setName("name2"); // No commit, so no real change. } void onSetToTransient() { button = new Button(); } void onSetToNull() { button = null; } void onDelete() { List buttons = ButtonDAO.findAll(); ButtonDAO.delete(buttons.toArray(new Button[0])); } } @Entity @Table(name = "button", catalog = "test", uniqueConstraints = {}) public class Button { private Integer id; private String name; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true) public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Column(name = "name", unique = false, nullable = false, insertable = true, updatable = true, length=128) @Validate("required,maxlength=128") public String getName() { return name; } public void setName(String name) { this.name = name; } } tml: http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> entity name: ${button.name} create entity change the name set to null delete set to transientt:eventlink> -- View this message in context: http://www.nabble.com/T5%3A-tapestry-hibernate-problem-when-setting-%40Persist%28%22entity%22%29-to-a-transient-object-tp18996169p18996169.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: tapestry-hibernate problem when setting @Persist("entity") to a transient object
Hi all, I am having some problems creating a simple crud with tapestry-hibernate 5.0.14. I followed the documentation and I have it mostly working. I can edit and save an existing entity with the @Persist("entity") annotation but if I try to create a new entity by setting the value to a newly instantiated entity I get this error: # org.apache.tapestry5.runtime.ComponentEventException Error persisting field PersistEntity:button: Failed persisting an entity in the session. Only entities attached to a Hibernate Session can be persisted. entity: [EMAIL PROTECTED] context eventType setToTransient # org.hibernate.TransientObjectException object references an unsaved transient instance - save the transient instance before flushing: com.roialte.entities.Button I figured I was doing something wrong so I copied the PersistEntity.tml and PersistEntity.java into my project from the tapestry-hibernate project. loaded the page and clicked the "set to transient" link and I got the same error. I am at a loss here as i cannot figure out what I'm doing wrong. How do u create a new entity for use within an edit page when using the @Persist('entity') annotation? I am using tapestry versions 5.0.14 and mysql 5.0 for my db. Any help is greatly appreciated. Thanks! here is a quick peek at my converted version of code from the tapesty-hibernate project: java: public class PersistEntity { @Persist("entity") @Property private Button button; @Inject private ButtonDAO ButtonDAO; @Inject private Session session; @Inject private HibernateSessionManager manager; void onCreateEntity() { Button button = new Button(); button.setName("name"); ButtonDAO.save(button); this.button = button; } void onChangeName() { button.setName("name2"); // No commit, so no real change. } void onSetToTransient() { button = new Button(); } void onSetToNull() { button = null; } void onDelete() { List buttons = ButtonDAO.findAll(); ButtonDAO.delete(buttons.toArray(new Button[0])); } } @Entity @Table(name = "button", catalog = "test", uniqueConstraints = {}) public class Button { private Integer id; private String name; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true) public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Column(name = "name", unique = false, nullable = false, insertable = true, updatable = true, length=128) @Validate("required,maxlength=128") public String getName() { return name; } public void setName(String name) { this.name = name; } } tml: http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> entity name: ${button.name} create entity change the name set to null delete set to transient -- View this message in context: http://www.nabble.com/T5%3A-tapestry-hibernate-problem-when-setting-%40Persist%28%22entity%22%29-to-a-transient-object-tp18996169p18996169.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tapestry-hibernate problem
i've tested the hibernate.cfg.xml and the mapping files. when i put them under classpath root. i get a exception page:do i need more configuration when use tapestry-hibernate? Render queue error in Expansion[PropBinding[expansion Start(hello)]]: Error invoking service builder method org.apache.tapestry5.hibernate.HibernateModule.build(HibernateSessionSource, PerthreadManager) (at HibernateModule.java:78) (for service 'HibernateSessionManager'): Exception constructing service 'HibernateSessionSource': Error invoking service builder method org.apache.tapestry5.hibernate.HibernateModule.build(Logger, List, RegistryShutdownHub) (at HibernateModule.java:117) (for service 'HibernateSessionSource'): tried to access field org.hibernate.cfg.Configuration.xmlHelper from class org.hibernate.cfg.AnnotationConfiguration -- View this message in context: http://www.nabble.com/tapestry-hibernate-problem-tp18483952p18483952.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5 tapestry-hibernate: problem with type coercing of HibernateEntityValueEncoder
hi, the HibernateEntityValueEncoder creates ValueEncoder for every contributed Entity class that's nice... but if i submit a page with a select component that used a list of entities to generate the selection model i will receive an exception if no option was selected! this is because the ValueEncoder will try to coerce the empty field to the type of the id field!! (i use blankOption=ALWAYS) the problem now is, that if i contribute my own ValueEncoder i get an IOC warning that there is already one registered for my entity class. I need either a way to disable the HibernateEntiyValueEncoder or a way to override the automatically generated ValueEncoders with a custom one. i think the HibernateEntityValueEncoder should only then attempt to reload the entity if the value is non-empty; if empty or null it should return null any suggestions? JIRA? g, krsi
Re: T4.1.3 Tapestry-hibernate problem
Hi Grigoris I will assume that your form is surrounding the @For component. Advices: * remove the updatePassenger it will confuse things. * persist "passengerList" in the session * populate "passengerList" on pageBeginRender * add a "keyExpression" to the For component * then save all the passengers at once. public void savePassengers() throws DataAccessException { try { for (Passenger passenger : getPassengerList()) { getSession().saveOrUpdate(passenger); } } catch (HibernateException e) { e.printStackTrace(); //nkons debug throw convertHibernateAccessException(e); } } I hope it helps. Regards. -- Alejandro Scandroli Amneris: We build process-driven web applications. http://www.amneris.es On Jan 12, 2008 4:54 PM, Grigoris Ioannou <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a dynamic form where the user can set a dynamic number of passengers. > The html looks like: > >source="ognl:passengerList" > value="ognl:currentPassengerId" > width="100%" > border="0"> > > >Title >Name >Surname >Age > > > > value="ognl:currentPassenger.name" > type="text" > class="textField" > maxlength="40" > size="26"/> > > > > value="ognl:currentPassenger.surname > " > type="text" > class="textField" > maxlength="40" > size="26"/> > > > > > > > > > The updatePassenger is an InvokeListener that executes this code: > > public void updatePassenger(IRequestCycle cycle) { > if (cycle.isRewinding()) { > > setCurrentPassenger(getPassengerManager().getPassengerById(getCurrentPassengerId())); > getPassengerManager().savePassenger(getCurrentPassenger()); > } else { > Passenger passenger = > getPassengerManager().getPassengerById(getCurrentPassengerId()); > setCurrentPassenger(passenger); > } > } > (The idea is that in the beginning I retrieve every Passenger's data from > the database and when the form is rewinding I store them in the database > again) > > The getPassengerManager() is a class responsible for handling the Passenger > objects, based on hibernate. The savePassenger function is: > > public void savePassenger(Passenger passenger) throws DataAccessException { > try { > getSession().saveOrUpdate(passenger); > } catch (HibernateException e) { > e.printStackTrace(); //nkons debug > throw convertHibernateAccessException(e); > } > } > > The problem is that when the user submits the form in which all these are > contained, the savePassenger is called (as it should) but nor does it update > the passengers or throw an exception. What am I doing wrong? > > The thing is that in the list with passengers, I am keeping the Ids of the > passengers, not the full Passenger Object, because the DataSqueezer produced > long strings that (I believe) caused some random problems in submission: > blank screens or no reaction. > > I am using Tapestry 4.1.3. Any help would be really appreciated. Thank you > in advance, > > Grigoris > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T4.1.3 Tapestry-hibernate problem
Hi all, I have a dynamic form where the user can set a dynamic number of passengers. The html looks like: Title Name Surname Age The updatePassenger is an InvokeListener that executes this code: public void updatePassenger(IRequestCycle cycle) { if (cycle.isRewinding()) { setCurrentPassenger(getPassengerManager().getPassengerById(getCurrentPassengerId())); getPassengerManager().savePassenger(getCurrentPassenger()); } else { Passenger passenger = getPassengerManager().getPassengerById(getCurrentPassengerId()); setCurrentPassenger(passenger); } } (The idea is that in the beginning I retrieve every Passenger's data from the database and when the form is rewinding I store them in the database again) The getPassengerManager() is a class responsible for handling the Passenger objects, based on hibernate. The savePassenger function is: public void savePassenger(Passenger passenger) throws DataAccessException { try { getSession().saveOrUpdate(passenger); } catch (HibernateException e) { e.printStackTrace(); //nkons debug throw convertHibernateAccessException(e); } } The problem is that when the user submits the form in which all these are contained, the savePassenger is called (as it should) but nor does it update the passengers or throw an exception. What am I doing wrong? The thing is that in the list with passengers, I am keeping the Ids of the passengers, not the full Passenger Object, because the DataSqueezer produced long strings that (I believe) caused some random problems in submission: blank screens or no reaction. I am using Tapestry 4.1.3. Any help would be really appreciated. Thank you in advance, Grigoris
Re: T5.06 The tapestry-hibernate problem? resoloved!
in my appModule.java, i changed : public void contributeHibernateSessionSource( OrderedConfiguration configuration) { configuration.add("my", "org.ts.domain.bo"); } 2007/10/26, Donyee <[EMAIL PROTECTED]>: > > > > I got errors when i use T5.06-hibernate, and my app works fine when i use > T5.05! > Also i changed the html to tml, sl4j... > Error: > No service implements the interface org.apache.tapestry.ioc.Configuration. > Error invoking service builder method > org.apache.tapestry.hibernate.HibernateModule.build(HibernateSessionSource, > ThreadCleanupHub) (at HibernateModule.java:73) (for service > 'HibernateSessionManager'): Exception constructing service > 'HibernateSessionSource': Error invoking service builder method > org.apache.tapestry.hibernate.HibernateModule.build(Logger, List) (at > HibernateModule.java:111) (for service 'HibernateSessionSource'): Error > invoking service contribution method > -- 徐 依伟
T5.06 The tapestry-hibernate problem?
I got errors when i use T5.06-hibernate, and my app works fine when i use T5.05! Also i changed the html to tml, sl4j... Error: No service implements the interface org.apache.tapestry.ioc.Configuration. Error invoking service builder method org.apache.tapestry.hibernate.HibernateModule.build(HibernateSessionSource, ThreadCleanupHub) (at HibernateModule.java:73) (for service 'HibernateSessionManager'): Exception constructing service 'HibernateSessionSource': Error invoking service builder method org.apache.tapestry.hibernate.HibernateModule.build(Logger, List) (at HibernateModule.java:111) (for service 'HibernateSessionSource'): Error invoking service contribution method
Re: tapestry hibernate problem
you shouldn't persist any object from hibernate @ApplicationState private Customer _customer; same object will be referenced in you second request, and the second request will have different session, tapestry-hibernate integration is still basic, and for now you should just change the above code to persist Cutomer.id and fetch the customer using the session in each request... Davor Hrg On 10/3/07, T. Papke <[EMAIL PROTECTED]> wrote: > > Hi, > > i have tried the tapestry-hibernate package to handle my hibernate > sessions. I have setup the package in maven and add the hibernate > Session to all constructors of my services. > > I started with my CustomerService getting and setting my customerbeans > (each of them having a Set of AddressBeans). After first time saving a > customer, everything works fine. If i do the saveOrUpdate again in a > second request (because i want to change something), i got: > /*"Illegal attempt to associate a collection with two open sessions"*/ > > I googled a lot, but i do not find the answer?? > I thought the tapestry-hibernate module open one session per request? It > seems so that the session from the previous request is still open? > > *service -->* > public class CustomerFactoryImpl implements CustomerFactory{ > private Session hibernateSession = null; > public CustomerFactoryImpl(Session session){ > this.hibernateSession=session; > } > public void setCustomer(Customer customer) { > hibernateSession.saveOrUpdate(customer); > } > } > *page -->* > public class CustomerData { > @Inject > private CustomerFactory customerFactory; > @ApplicationState > private Customer _customer; > > public void onSuccess(){ > customerFactory.setCustomer(_customer); > } > > } > *bean --->* > @Entity > public class Customer{ > @Id > @GeneratedValue > private long id; > ... lots of simple attributes > @OneToMany > @Cascade(CascadeType.ALL) > private Set address= new HashSet(); > access methods to addresses ... > } > > It seems so simple, but i don't know whats going wrong? Anyone an idea? > > Thanks a lot, > Thomas >
tapestry hibernate problem
Hi, i have tried the tapestry-hibernate package to handle my hibernate sessions. I have setup the package in maven and add the hibernate Session to all constructors of my services. I started with my CustomerService getting and setting my customerbeans (each of them having a Set of AddressBeans). After first time saving a customer, everything works fine. If i do the saveOrUpdate again in a second request (because i want to change something), i got: /*"Illegal attempt to associate a collection with two open sessions"*/ I googled a lot, but i do not find the answer?? I thought the tapestry-hibernate module open one session per request? It seems so that the session from the previous request is still open? *service -->* public class CustomerFactoryImpl implements CustomerFactory{ private Session hibernateSession = null; public CustomerFactoryImpl(Session session){ this.hibernateSession=session; } public void setCustomer(Customer customer) { hibernateSession.saveOrUpdate(customer); } } *page -->* public class CustomerData { @Inject private CustomerFactory customerFactory; @ApplicationState private Customer _customer; public void onSuccess(){ customerFactory.setCustomer(_customer); } } *bean --->* @Entity public class Customer{ @Id @GeneratedValue private long id; ... lots of simple attributes @OneToMany @Cascade(CascadeType.ALL) private Set address= new HashSet(); access methods to addresses ... } It seems so simple, but i don't know whats going wrong? Anyone an idea? Thanks a lot, Thomas
tapestry hibernate problem
Hi, i have tried the tapestry-hibernate package to handle my hibernate sessions. I have setup the package in maven and add the hibernate Session to all constructors of my services. I started with my CustomerService getting and setting my customerbeans (each of them having a Set of AddressBeans). After first time saving a customer, everything works fine. If i do the saveOrUpdate again in a second request (because i want to change something), i got: /*"Illegal attempt to associate a collection with two open sessions"*/ I googled a lot, but i do not find the answer?? I thought the tapestry-hibernate module open one session per request? It seems so that the session from the previous request is still open? *service -->* public class CustomerFactoryImpl implements CustomerFactory{ private Session hibernateSession = null; public CustomerFactoryImpl(Session session){ this.hibernateSession=session; } public void setCustomer(Customer customer) { hibernateSession.saveOrUpdate(customer); } } *page -->* public class CustomerData { @Inject private CustomerFactory customerFactory; @ApplicationState private Customer _customer; public void onSuccess(){ customerFactory.setCustomer(_customer); } } *bean --->* @Entity public class Customer{ @Id @GeneratedValue private long id; ... lots of simple attributes @OneToMany @Cascade(CascadeType.ALL) private Set address= new HashSet(); access methods to addresses ... } It seems so simple, but i don't know whats going wrong? Anyone an idea? Thanks a lot, Thomas