-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: i succeed use the hibrnate in the mbean of jboss,but...
PostPosted: Tue May 25, 2004 11:51 am 
Regular
Regular

Joined: Tue Dec 30, 2003 2:35 am
Posts: 85
i succeed use the hibrnate in the mbean of jboss,but,when i operate the database ,the JSP page tell me the error(but i debug the code in the eclipse,the whole code runs ok):

the console of the jboss tell me(it seems like ok)
Code:
.....
.....
23:35:38,685 INFO  [SettingsFactory] Use scrollable result sets: true
23:35:38,695 INFO  [SettingsFactory] Use JDBC3 getGeneratedKeys(): false
23:35:38,695 INFO  [SettingsFactory] Optimize cache for minimal puts: false
23:35:38,695 INFO  [SettingsFactory] Query language substitutions: {}
23:35:38,695 INFO  [SettingsFactory] cache provider: net.sf.ehcache.hibernate.Pr
ovider
23:35:38,695 INFO  [Configuration] instantiating and configuring caches
23:35:38,695 INFO  [SessionFactoryImpl] building session factory


but after building session factory,the JSP page tell me the error:
Code:
net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem


here is my JSP page code:
Code:
<%@ page contentType="text/html;charset=GBK" %>
<%@ page language="java" %>
<%@ page import="javax.naming.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="net.sf.hibernate.SessionFactory" %>
<%@ page import="net.sf.hibernate.Session" %>
<%@ page import="net.sf.hibernate.Transaction" %>
<%!
  javax.sql.DataSource ds;
  SessionFactory sf;
  Session objSession;
  Transaction tx;
%>

<%
  try {
      Context ctx = new InitialContext();
      out.println("start use the hibernate<br>");
      sf = (SessionFactory)ctx.lookup("java:/hibernate/HibernateFactory");
      objSession = sf.openSession();
      tx = objSession.beginTransaction();
      ......
      objSession.flush();
      tx.commit();
      out.println("end use the hibernate<br>");
    } catch (Exception e) {
      out.println("error!!!!!!!!!!!!!!" + e.toString());
    }
%>


but i only use hibernate in the eclipse to debug without jboss,the whole code runs ok!

how does it happen!!

thanks a lot!!


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2004 11:53 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
Read documentation about lazy loading...
You ll find response.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.