[JBoss-user] [JBoss Seam] - [LazyInitializationException] could not initialize proxy - t

2006-05-29 Thread sws42
Hi all,

I'm getting the above error while trying to show entities with lazy-loaded 
properties. 
I have a SLSB in which I retrieve an Entity from the Database. 
The EntityBean is as follow:


  | public class Walzen  implements java.io.Serializable {
  | .
  | .
  | .
  |  private Werkstoffe werkstoffe;
  | .
  | .
  | .
  |   @ManyToOne(cascade={},
  | fetch=FetchType.LAZY)
  | 
  | @JoinColumn(name=WERKSTOFF, unique=false, nullable=false, 
insertable=true, updatable=true)
  | 
  | public Werkstoffe getWerkstoffe() {
  | return this.werkstoffe;
  | }
  | .
  | .
  | .
  | }
  | 
where Werkstoffe is also an EntityBean:

  | @Entity
  | @Table(name=WERKSTOFFE
  | , uniqueConstraints = {  }
  | )
  | 
  | public class Werkstoffe  implements java.io.Serializable {
  | .
  | .
  | .
  | 
  | @Column(name=NAME, unique=false, nullable=false, insertable=true, 
updatable=true)
  | 
  | public String getName() {
  | return this.name;
  | }
  | .
  | .
  | .
  | }
  | 
  | 

In my SessionBean I do a simple select w from Walzen in a  @Factory-Method. 
As I try to show the name-Attribute in the JSP  like:

  | f:view
  | t:dataTable id=walzen var=walze value=#{walzenliste}
  | t:column
  | h:outputLabel value=#{walze.hydronummer}
  | /h:outputLabel 
  | /t:column
  | t:column
  | h:outputLabel value=#{walze.werkstoffe.name}
  | /h:outputLabel 
  | /t:column
  | /t:dataTable
  | 
  | 
  | /f:view
  | 
I get the above Error.


  | 12:27:17,532 ERROR [LazyInitializationException] could not initialize proxy 
- the owning Session was closed
  | org.hibernate.LazyInitializationException: could not initialize proxy - the 
owning Session was closed
  | at 
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:60)
  | at 
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
  | at 
org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:196)
  | at 
de.hydro.gv.walzen.entities.Werkstoffe_$$_javassist_183.getName(Werkstoffe_$$_javassist_183.java)
  | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | at java.lang.reflect.Method.invoke(Method.java:585)
  | at 
org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
  | at 
org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
  | at 
org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:532)
  | at 
org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
  | at 
org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
  | at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
  | at 
org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
  | at 
org.apache.myfaces.renderkit.html.HtmlLabelRenderer.encodeBegin(HtmlLabelRenderer.java:78)
  | at 
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:512)
  | at 
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:433)
  | at 
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:419)
  | at 
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:440)
  | at 
org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.renderColumnBody(HtmlTableRenderer.java:286)
  | at 
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.encodeColumnChild(HtmlTableRendererBase.java:181)
  | at 
org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.encodeColumnChild(HtmlTableRenderer.java:241)
  | at 
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:167)
  | at 
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:100)
  | at 
org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.encodeChildren(HtmlTableRenderer.java:113)
  | at 
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
  | at 
javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:480)
  | at 
javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:361)
  | at 
org.apache.myfaces.shared_tomahawk.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:54)
  | 

[JBoss-user] [JBoss Seam] - LazyInitializationException

2006-05-06 Thread drapierwim
As you can see I'm having a LazyInitializationException error that I can't seem 
to fix.

First of all this stuff worked before just fine a couple months ago, the only 
thing changed is that I now use jBPM pageflow

Here is a piece of my faces.config 

  | lifecycle
  | 
!--phase-listenerorg.jboss.seam.jsf.SeamPhaseListener/phase-listener--
  | 
!--phase-listenerorg.jboss.seam.jsf.SeamTransactionManagedPersistencePhaseListener/phase-listener--
  | 
phase-listenerorg.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener/phase-listener
  | /lifecycle
  | 
Here is the web.xml

  | filter
  | filter-nameSeam Exception Filter/filter-name
  | 
filter-classorg.jboss.seam.servlet.SeamExceptionFilter/filter-class
  | /filter
  | 
  | filter
  | filter-nameSeam Redirect Filter/filter-name
  | 
filter-classorg.jboss.seam.servlet.SeamRedirectFilter/filter-class
  | /filter
  | 
  | filter-mapping
  | filter-nameSeam Exception Filter/filter-name
  | url-pattern/*/url-pattern
  | /filter-mapping
  | 
  | filter-mapping
  | filter-nameSeam Redirect Filter/filter-name
  | url-pattern*.seam/url-pattern
  | /filter-mapping
  | 

My statefullbean

  | @Stateful
  | @Name(accountsManager)
  | @Scope(ScopeType.CONVERSATION)
  | @Conversational(ifNotBegunOutcome=home_page)
  | public class AccountsServiceBean implements AccountsService, Serializable {
  | 
  | private static final Logger log = 
Logger.getLogger(AccountsServiceBean.class);
  | 
  | @PersistenceContext(type=PersistenceContextType.EXTENDED)
  | private EntityManager em;
  | 
  | @DataModel(scope=ScopeType.PAGE)
  | private ListAccount accounts;
  | @DataModelSelectionIndex
  | private int accountIndex;
  | 
  | @Out(required=false, scope=ScopeType.PAGE)
  | private Account bookAccount;
  | 
  | private boolean lookupMode;
  | 
  | public boolean isLookupMode() {
  | return lookupMode;
  | }
  | 
  | private void setLookupMode(boolean lookupMode) {
  | this.lookupMode = lookupMode;
  | }
  | 
  | public Account getAccount() {
  | return bookAccount;
  | }
  | 
  | @Create
  | public void create() {
  | log.info(created);
  | }
  | 
  | //@Begin(join=true)
  | @Factory(accounts)
  | @SuppressWarnings(unchecked)
  | public void load() {
  | accounts = em.createQuery(from Account a  +
  | where a.number between 1 and 7)
  | .getResultList();
  | }
  | 
  | public void find(){
  | setLookupMode(true);
  | load();
  | }
  | 
  | public void getChilderen() {
  | bookAccount = accounts.get(accountIndex);
  | accounts = ((SummaryAccount)bookAccount).getChildAccounts();
  | }
  | 
  | public void addNew() {
  | 
  | }
  | 
  | public void delete() {
  | 
  | }
  | 
  | @Begin(nested=true)
  | public String lookup() {
  | setLookupMode(true);
  | find();
  | return accounts_page;
  | }
  | 
  | @End
  | public void select() {
  | setLookupMode(false);
  | bookAccount = accounts.get(accountIndex);
  | }
  | 
  | @Destroy
  | public void destroy() {
  | log.info(destroyed);
  | }
  | 
Stacktrace...

  | 15:11:38,413 ERROR [LazyInitializationException] failed to lazily 
initialize a collection of role: 
be.drapier.domain.SummaryAccount.childAccounts, no session or session was closed
  | org.hibernate.LazyInitializationException: failed to lazily initialize a 
collection of role: be.drapier.domain.SummaryAccount.childAccounts, no session 
or session was closed
  | at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
  | at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
  | at 
org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
  | at org.hibernate.collection.PersistentBag.size(PersistentBag.java:222)
  | at javax.faces.model.ListDataModel.isRowAvailable(ListDataModel.java:82)
  | at javax.faces.model.ListDataModel.setRowIndex(ListDataModel.java:95)
  | at 
javax.faces.model.ListDataModel.setWrappedData(ListDataModel.java:109)
  | at javax.faces.model.ListDataModel.init(ListDataModel.java:40)
  | at org.jboss.seam.jsf.ListDataModel.init(ListDataModel.java:31)
  | at org.jboss.seam.Component.outjectDataModelList(Component.java:847)
  | at org.jboss.seam.Component.outjectDataModel(Component.java:829)
  | at 

[JBoss-user] [JBoss Seam] - LazyInitializationException with SeamExtendedManagedPersiste

2006-01-27 Thread liebner
Hi,

I still get the dreaded LazyInitializationException although I'm using the 
SeamExtendedManagedPersistencePhaseListener.

My entity manager is bound to the jndi context, I can query an EJB3 entity with 
it, but when I try to navigate down a OneToMany relationship I get 
anonymous wrote : 
  | [LazyInitializationException] failed to lazily initialize a collection of 
role: ..., no session or session was closed
  | 

My setting is similar to your generated code:

From a JSF List page I call a SFSB (List Bean) method which is annoted with 
@Begin and delegates handling to another SFSB (Editor/Show Bean). The 
rendering JSF View then asks for the Set with the many end of the relation. 
The getter is annoted as a @DataModel.

But from that method I get the error mentioned above.

What could be wrong?

Greetings,
Stefan

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3920127#3920127

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3920127


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user