Can somebody help me I'm having a
net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem
Since my junit tests doesnt fail. I think that the answer of my problem lies with the J2ee container.
I'm using JBoss 4sp1, Hibernate 2.1 and xdoclet1.2.2 and a MySql DB, below is my msql-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<datasources> <local-tx-datasource> <jndi-name>MySqlDS</jndi-name> <connection-url>jdbc:mysql://server:3306/les</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>root</user-name> <password>root</password> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <track-statements>false</track-statements> <min-pool-size>10</min-pool-size> <max-pool-size>30</max-pool-size> <blocking-timeout-millis>10000</blocking-timeout-millis> <idle-timeout-minutes>15</idle-timeout-minutes> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> <check-valid-connection-sql>select LAST_INSERT_ID()</check-valid-connection-sql> <metadata> <type-mapping>mySQL</type-mapping> </metadata> </local-tx-datasource> </datasources>
and here is the code from my sessionbean (just in case...)
/** * @throws Exception * @ejb.interface-method view-type="local" */ public List getAllJournals() { logger.info("getAllJournals method called."); return (List) HibernateRunner.executeWrapCheckedExceptions(new HibernateTemplate() { public Object execute(Session session) throws Exception { return session.find("from " + Journal.class.getName()); } }); }
I have posted this question on the jboss forum and didn't get any help there, so some help would be welcome.
Thanks and sorry for my the poor english ;-)
|