[JBoss Seam] - Seam 1.3.0.ALPHA entity converter: The instance was not asso
by fhh
Hello!
Seam 1.3.0.ALPHA gives me the following exception:
| org.hibernate.TransientObjectException: The instance was not associated with this session
| at org.hibernate.impl.SessionImpl.getIdentifier(SessionImpl.java:1375)
| at org.jboss.seam.persistence.HibernatePersistenceProvider.getId(HibernatePersistenceProvider.java:51)
| at org.jboss.seam.framework.EntityIdentifier.<init>(EntityIdentifier.java:15)
| at org.jboss.seam.ui.EntityConverterStore.put(EntityConverterStore.java:61)
| at org.jboss.seam.ui.EntityConverter.getAsString(EntityConverter.java:68)
|
|
I can only guess what happens:
For performance reasons I have a factory that outject the result of an entity query into the user's sessions, so the db is hit only once per session. Everthing work well the first time, but the second time I hit that page - in a completly new conversation - the entities in that cached list are not associated with the current entitymanager anymore and the mentioned exception is thrown.
Not sure if I am doing something wrong here but this used to work in Seam 1.2.1.GA.
Regards
Felix
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055051#4055051
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055051
18Â years, 10Â months
[JBoss Seam] - Re: Seam 1.3.0.ALPHA UI example doubt
by petemuir
Using a managed rather than detached entity causes the UOE to go away.
@Name("personAction")
| @Scope(ScopeType.CONVERSATION)
| public class PersonAction {
|
| @In(create=true)
| private EntityManager entityManager;
|
| private Person person;
|
| private Integer id;
|
|
| @Transactional
| public String update() {
| entityManager.joinTransaction();
| //entityManager.merge(person);
| entityManager.flush();
| return "Success";
| }
|
| @Transactional
| public Person getInstance() {
| if (person != null && entityManager.contains(person)) {
| return person;
| } else {
| entityManager.joinTransaction();
| person = entityManager.find(Person.class, id);
| return person;
| }
| }
|
| public Integer getId() {
| return id;
| }
|
| public void setId(Integer id) {
| this.id = id;
| }
|
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055050#4055050
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055050
18Â years, 10Â months