Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Seam /2.2.1.CR1 EntityQuery bug?

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted this question http://seamframework.org/Community/221CR1EntityQueryBug but got no response(never got). So I thought maybe can get some help here.

I generated UserList.java(EntityQuery class) and UserList.xthml using "seam generate-ui" command, based on entity class: User.java.

The problem is: when testing the search function in UserList.xhtml, I got the following error:

WARN [org.jboss.seam.Component] Cannot create Seam component, scope is not active: entityManager(CONVERSATION)



I searched deeper into code and found this seems something inevitable.

After 'Search's clicked, UserList.xhtml will go into JSF restore view phase. Since the page uses 'userList' component, the component needs to be created.

When creating 'userList' component, it needs to call component's @Create method, which is validate(). In EntityQuery's validate method, it checks for entity manager, which is in conversation scope.

The problem is, at that time, conversation context has not been created for the thread. Thus entity manager cannot be created. Exception throws.

An interesting thing is, the conversation context is created just after that, in handleAfterPhase of restore view phase:

SeamPhaseListener.java:


FacesLifecycle.java:



Have I missed anything? Or it's a bug?
 
What are your superhero powers? Go ahead and try them on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic