-->
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.  [ 3 posts ] 
Author Message
 Post subject: JNDI bound SessionFactory in SUN Application Server.
PostPosted: Sat Jun 04, 2005 2:44 pm 
Newbie

Joined: Tue May 17, 2005 8:39 am
Posts: 14
Hi

Is it possible to use JNDI bound SessionFactory in SUN Application Server 8.1 ? I load Hibernate from a WEB module. I can lookup SessionFactory from the WEB module, but it's not possible from EJB module.

From this log it seems that SessionFactoryObjectFactory gets initialized two times: first when I do lookup from WEB module and second - from EJB module. SessionFactory gets registered only in first instance of SessionFactoryObjectFactory, therefore lookup from EJB module fails.

Any ideas ?


Hibernate version:
2.18
Mapping documents:

<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/PointBase</property>
<property name="show_sql">true</property>
<property name="dialect">net.sf.hibernate.dialect.PointbaseDialect</property>
<property name="session_factory_name">hibernate/SessionFactory</property>

<mapping resource="newpackage/King.hbm.xml"/>

</session-factory>
</hibernate-configuration>

Hibernate log excerpt:


[#|2005-06-04T20:59:09.265+0300|INFO|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryImpl|_ThreadID=10;|building session factory|#]

[#|2005-06-04T20:59:10.453+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|initializing class SessionFactoryObjectFactory|#]

[#|2005-06-04T20:59:10.453+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|registered: 8a8a8a4304488195010448819b360000 (hibernate/SessionFactory)|#]

[#|2005-06-04T20:59:10.453+0300|INFO|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|Factory name: hibernate/SessionFactory|#]

[#|2005-06-04T20:59:10.453+0300|INFO|sun-appserver-pe8.1_01|net.sf.hibernate.util.NamingHelper|_ThreadID=10;|JNDI InitialContext properties:{}|#]

[#|2005-06-04T20:59:10.484+0300|INFO|sun-appserver-pe8.1_01|net.sf.hibernate.dialect.Dialect|_ThreadID=10;|Using dialect: net.sf.hibernate.dialect.PointbaseDialect|#]

[#|2005-06-04T20:59:10.500+0300|WARNING|sun-appserver-pe8.1_01|javax.enterprise.system.stream.err|_ThreadID=10;|java.lang.Error: Using the FastClass empty constructor--please report to the cglib-devel mailing list
at net.sf.cglib.reflect.FastClass.<init>(FastClass.java:31)
at sun.reflect.GeneratedSerializationConstructorAccessor104.newInstance(Unknown Source)
...
|#]

[#|2005-06-04T20:59:10.593+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|lookup: uid=8a8a8a4304488195010448819b360000|#]

[#|2005-06-04T20:59:10.593+0300|INFO|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|Bound factory to JNDI name: hibernate/SessionFactory|#]

[#|2005-06-04T20:59:10.593+0300|WARNING|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|InitialContext did not implement EventContext|#]

[#|2005-06-04T20:59:10.593+0300|INFO|sun-appserver-pe8.1_01|net.sf.hibernate.dialect.Dialect|_ThreadID=10;|Using dialect: net.sf.hibernate.dialect.PointbaseDialect|#]

[#|2005-06-04T20:59:10.593+0300|WARNING|sun-appserver-pe8.1_01|javax.enterprise.system.stream.err|_ThreadID=10;|
java.lang.Error: Using the FastClass empty constructor--please report to the cglib-devel mailing list
at net.sf.cglib.reflect.FastClass.<init>(FastClass.java:31)
at sun.reflect.GeneratedSerializationConstructorAccessor104.newInstance(Unknown Source)
...
|#]

[#|2005-06-04T20:59:10.609+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|lookup: uid=8a8a8a4304488195010448819b360000|#]

[#|2005-06-04T20:59:10.609+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|JNDI lookup: hibernate/SessionFactory|#]

[#|2005-06-04T20:59:10.609+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|lookup: uid=8a8a8a4304488195010448819b360000|#]

[#|2005-06-04T20:59:10.609+0300|SEVERE|sun-appserver-pe8.1_01|newpackage.NewServletListener|_ThreadID=10;|SUCCESS !!! net.sf.hibernate.impl.SessionFactoryImpl|#]

[#|2005-06-04T20:59:10.703+0300|INFO|sun-appserver-pe8.1_01|net.sf.hibernate.dialect.Dialect|_ThreadID=10;|Using dialect: net.sf.hibernate.dialect.PointbaseDialect|#]

[#|2005-06-04T20:59:10.703+0300|WARNING|sun-appserver-pe8.1_01|javax.enterprise.system.stream.err|_ThreadID=10;|
java.lang.Error: Using the FastClass empty constructor--please report to the cglib-devel mailing list
at net.sf.cglib.reflect.FastClass.<init>(FastClass.java:31)
at sun.reflect.GeneratedSerializationConstructorAccessor104.newInstance(Unknown Source)
...
|#]

[#|2005-06-04T20:59:11.250+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|initializing class SessionFactoryObjectFactory|#]

[#|2005-06-04T20:59:11.250+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|lookup: uid=8a8a8a4304488195010448819b360000|#]

[#|2005-06-04T20:59:11.250+0300|WARNING|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|Not found: 8a8a8a4304488195010448819b360000|#]


[#|2005-06-04T20:59:11.265+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|{}|#]

[#|2005-06-04T20:59:11.265+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|lookup: name=hibernate/SessionFactory|#]

[#|2005-06-04T20:59:11.265+0300|WARNING|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|Not found: hibernate/SessionFactory|#]

[#|2005-06-04T20:59:11.265+0300|FINE|sun-appserver-pe8.1_01|net.sf.hibernate.impl.SessionFactoryObjectFactory|_ThreadID=10;|{}|#]

[#|2005-06-04T20:59:11.281+0300|WARNING|sun-appserver-pe8.1_01|javax.enterprise.resource.corba.S1AS-ORB.rpc.encoding|_ThreadID=10;|"IOP00810211: (MARSHAL) Exception from readValue on ValueHandler in CDRInputStream"
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.valuehandlerReadException(ORBUtilSystemException.java:6674)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1045)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:879)
...
Caused by: java.io.InvalidObjectException: Could not find a SessionFactory named: hibernate/SessionFactory
at net.sf.hibernate.impl.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:408)
... 61 more
|#]

[#|2005-06-04T20:59:11.281+0300|SEVERE|sun-appserver-pe8.1_01|javax.enterprise.system.core.naming|_ThreadID=10;|NAM0004: Exception during name lookup : {0}
java.rmi.MarshalException: CORBA MARSHAL 1398079699 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:197)
...
|#]

[#|2005-06-04T20:59:11.281+0300|SEVERE|sun-appserver-pe8.1_01|newpackage2005.NewSessionBean|_ThreadID=10;|Cannot lookup SessionFactory
javax.naming.CommunicationException: serial context communication ex [Root exception is java.rmi.MarshalException: CORBA MARSHAL 1398079699 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe]
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:328)
...
Caused by: java.io.InvalidObjectException: Could not find a SessionFactory named: hibernate/SessionFactory
at net.sf.hibernate.impl.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:408)
... 61 more
|#]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 5:54 am 
Newbie

Joined: Sun Jul 17, 2005 12:25 pm
Posts: 5
Can you help me with some configuration examples?
I also want to use Hibernate in Sun Appserver but don't know how to start.
I'm really new to J2EE but have used Hibernate before.

Any hints you can give me or some documentation (I haven't found any besides the JBoss examples).

Thanks in advance
Knista


Top
 Profile  
 
 Post subject: Paging, Criteria APIs and count(*)
PostPosted: Wed Sep 28, 2005 2:51 pm 
Newbie

Joined: Tue May 17, 2005 8:39 am
Posts: 14
Hi

I have written an application with search screens where I use Hibernate's 2.1 Criteria API to dynamically generate select queries. I use setFirstResult() and setMaxResult to implement paging of result set, because there can be a lot of records in database.

Now I need to get total number of records that satisfy given criteria. So I can display something like "x-y from total z records". Which would be the best way to get total number of records ? I have some ideas, for example:

1) If it's possible to get SQL statement generated by Hibernate (?) I could modify by replacing fields with "count (*)"

2) It's also possible to read all records from db and display just a subset, but it would have very bad performance.

Any ideas ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.