I was able to trace the calls until I found where the error was coming from. Basically it comes because the entityManager is null, and it tries to create one by name. Since I didn't have "entityManager" defined in my components.xml it never created one.
Since you mentioned that Seam 2.0 had redone this area, I decided to upgrade before adding stuff to my components.xml since it seemed weird that it would have an entitymanager available for the rest of the stuff except for this (but I think I know why now)
So I updated to Seam 2.0 and when I run it now I get this error:
|
java.lang.NullPointerException | at org.jboss.seam.framework.EntityIdentifier.<init>(EntityIdentifier.java:15)
| at org.jboss.seam.ui.converter.EntityConverterStore.put(EntityConverterStore.java:60)
| at org.jboss.seam.ui.converter.EntityConverter.getAsString(EntityConverter.java:69)
| at
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getFormattedValue (
HtmlBasicRenderer.java:469)
| at
com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.renderOption (
SelectManyCheckboxListRenderer.java:249)
| at
com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.encodeEnd (
SelectManyCheckboxListRenderer.java:146)
| at
javax.faces.component.UIComponentBase.encodeEnd (
UIComponentBase.java:833)
| at
javax.faces.component.UIComponent.encodeAll (
UIComponent.java:896)
| at
javax.faces.render.Renderer.encodeChildren (
Renderer.java:137)
| at
javax.faces.component.UIComponentBase.encodeChildren (
UIComponentBase.java:809)
|
which leads me to believe it's the same issue. There is no entityManager. I didn't debug, but since it wasn't working before I wasn't expecting it to now.
So I added the following to the components.xml:
| <persistence:managed-persistence-context name="entityManager"
| auto-create="true"
| persistence-unit-jndi-name="java:/numinsPersistenceUnit" />
|
Now I get:
|
org.hibernate.TransientObjectException: The instance was not associated with this session
| at
org.hibernate.impl.SessionImpl.getIdentifier (
SessionImpl.java:1375)
| at org.hibernate.search.impl.FullTextSessionImpl.getIdentifier(FullTextSessionImpl.java:331)
| at org.jboss.seam.persistence.HibernateSessionProxy.getIdentifier(HibernateSessionProxy.java:205)
| at org.jboss.seam.persistence.HibernatePersistenceProvider.getId(HibernatePersistenceProvider.java:114)
| at org.jboss.seam.framework.EntityIdentifier.<init>(EntityIdentifier.java:15)
| at org.jboss.seam.ui.converter.EntityConverterStore.put(EntityConverterStore.java:60)
|
With this I think that the original object was loaded with something else and that another entitymanager is trying to use it now. Is this because of the whole Seam managed thing?
I don't have my entities defined in components.xml. I just have the @Entity annotation in the class itself.
I went ahed and changed the @Name to something else so it wouldn't collide and added it to the components.xml to try it out. So I added:
| <framework:entity-home name="role"
| entity-class="com.numbersinsight.data.security.Role"
| scope="session"
| auto-create="true">
| <framework:id>#{roleId}</framework:id>
| </framework:entity-home>
|
And the error message is:
| Caused by:
java.lang.IllegalArgumentException: Can not set com.numbersinsight.data.security.Role field com.numbersinsight.admin.action.RoleFinderAction.role to org.jboss.seam.framework.EntityHome_$$_javassist_68
| at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException (
UnsafeFieldAccessorImpl.java:146)
| at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException (
UnsafeFieldAccessorImpl.java:150)
| at
sun.reflect.UnsafeObjectFieldAccessorImpl.set (
UnsafeObjectFieldAccessorImpl.java:63)
| at
java.lang.reflect.Field.set (
Field.java:657)
| at org.jboss.seam.util.Reflections.set(Reflections.java:64)
|
Why isn't it using the same entitymanager all around?
I think I'm moving in the right direction and have an idea of how it's behaving, but it's confusing.
I also tried using the hibernate-entity-home and got a class cast about going from a seam session to a hibernate session. I'll keep playing around to see what I can find.
Any ideas?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4072847#4072847
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4072847
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user