Hibernate3.0, JBoss4.0.2, JDK-1.4.2_01
I have two files. techdesk.har and techdesk.war. The har file has only three
classes made persistent, and deploys correctly, and the SessionFactory bound
correctly in JNDI:
anonymous wrote : 2005-07-26 22:40:52,511 INFO
[org.jboss.hibernate.jmx.Hibernate] SessionFactory successfully built and bound
into JNDI [java:/TechDesk/SessionFactory]
However, when I access my servlet with code to load a class from hibernate,
nothing comes back (not even errors or exceptions). I even have ShowSQL=true
in my hibernate parameters, but no SQL statements were output'd. Here is the
log from when I access the servlet:
anonymous wrote : 2005-07-26 22:30:30,557 DEBUG
[org.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup:
TechDesk/SessionFactory
| 2005-07-26 22:30:30,557 DEBUG
[org.hibernate.impl.SessionFactoryObjectFactory] lookup:
uid=8a8be5ef0555af6a010555af8d9e0001
| 2005-07-26 22:30:30,557 DEBUG [org.hibernate.jdbc.JDBCContext] no active
transaction, could not register Synchronization
| 2005-07-26 22:30:30,557 DEBUG [org.hibernate.impl.SessionImpl] opened
session at timestamp: 4597479139561472
| 2005-07-26 22:30:30,567 DEBUG [org.hibernate.transaction.JTATransaction]
begin
| 2005-07-26 22:30:30,567 DEBUG [org.hibernate.transaction.JTATransaction]
Looking for UserTransaction under: UserTransaction
| 2005-07-26 22:30:30,567 DEBUG [org.hibernate.transaction.JTATransaction]
Obtained UserTransaction
| 2005-07-26 22:30:30,567 DEBUG [org.hibernate.transaction.JTATransaction]
Began a new JTA transaction
| 2005-07-26 22:30:30,577 DEBUG [org.hibernate.jdbc.JDBCContext] successfully
registered Synchronization
| 2005-07-26 22:30:30,697 DEBUG [org.hibernate.transaction.JTATransaction]
commit
| 2005-07-26 22:30:30,697 DEBUG
[org.hibernate.transaction.CacheSynchronization] transaction before completion
callback
| 2005-07-26 22:30:30,697 DEBUG
[org.hibernate.transaction.CacheSynchronization] automatically flushing session
| 2005-07-26 22:30:30,697 DEBUG [org.hibernate.impl.SessionImpl]
automatically flushing session
| 2005-07-26 22:30:30,697 DEBUG [org.hibernate.jdbc.JDBCContext] before
transaction completion
| 2005-07-26 22:30:30,697 DEBUG [org.hibernate.impl.SessionImpl] before
transaction completion
| 2005-07-26 22:30:30,697 DEBUG
[org.hibernate.transaction.CacheSynchronization] transaction after completion
callback, status: 3
| 2005-07-26 22:30:30,697 DEBUG [org.hibernate.jdbc.JDBCContext] after
transaction completion
| 2005-07-26 22:30:30,697 DEBUG [org.hibernate.impl.SessionImpl] after
transaction completion
| 2005-07-26 22:30:30,697 DEBUG
[org.hibernate.transaction.CacheSynchronization] automatically closing session
| 2005-07-26 22:30:30,697 DEBUG [org.hibernate.impl.SessionImpl]
automatically closing session
| 2005-07-26 22:30:30,697 DEBUG [org.hibernate.impl.SessionImpl] closing
session
| 2005-07-26 22:30:30,697 DEBUG [org.hibernate.transaction.JTATransaction]
Committed JTA UserTransaction
| 2005-07-26 22:30:36,536 DEBUG [org.hibernate.jdbc.JDBCContext] running
Session.finalize()
Here is a snip of the code that calls the hibernate lookup:
| Transaction tx = null;
| Session session = null;
| try {
| InitialContext ctx = new InitialContext();
| SessionFactory factory = (SessionFactory) ctx
|
.lookup("java:/TechDesk/SessionFactory");
| session = factory.openSession();
| } catch (NamingException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
|
| PrintWriter out = resp.getWriter();
| tx = session.beginTransaction();
| try {
| List results =
session.createCriteria(Ticket.class).list();
| for (Iterator i = results.iterator(); i.hasNext();) {
| Ticket ticket = (Ticket) i.next();
| out.println(ticket.getId() + " " +
ticket.getProblem());
| if (ticket.getOwner() != null) {
|
out.println(ticket.getOwner().getUsername());
| } else {
| out.println("No Owner");
| }
| }
| } catch (HibernateException e) {
| e.printStackTrace();
| } finally {
| tx.commit();
| }
|
Can anyone point out what I'm doing wrong? I've been staring at this code for
too long, and need a fresh set of (experienced) eyes. This code works
correctly outside of JBoss and Tomcat using a POJO.
Thanks so much!
--Aaron
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3886711#3886711
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3886711
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user