[Persistence, JBoss/CMP, Hibernate, Database] - Transferring entities on the client side
by dimar1975
Hi all !
I'm writing an application which uses Hibernate for querying DB Objects. I have a manager class which Starts an Hibernate Session and returns the Objects to the application:
public static List<MyObject> findRoot() {
| Session session = SessionFactoryUtil.getSessionFactory().getCurrentSession();
| session.beginTransaction();
| Query query = session.createQuery("FROM MyObject");
| session.getTransaction().commit();
| return (List<MyObject>)query.list();
| }
The problem is that, if I issue a session.commit(), then I'm not able to return Objects, rather Hibernate issues "org.hibernate.SessionException: Session is closed!"
What is the correct way to return Objects ?
Should I issue a commit from my application, after I have Iterated on the Objects ? (I don't like this solution, becuase I'd like to keep separated the Hibernate logic from the front-end layer)
Should I rather clone the objects and return the detached cloned object to the client ?
What happens instead if I don't issue the commit after the Query ? the session will stay open and therefore I'll have DB leaks ?
thanks a lot
Marco
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4237260#4237260
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4237260
17 years, 1 month
[Installation, Configuration & DEPLOYMENT] - JBoss [Zion] 4.0.2 HANGS at startup on HP-UX B.11.11, PA_RI
by xoriant_jboss
Hi,
Below given is my env. configuration
App server : JBoss [Zion] 4.0.2
OS : HP-UX B.11.11,PA_RISC2.0
jdk version : 1.4.2.09,Hewlett-Packard Co.
And below are the traces
Sorry cannot give full log details due to security reasons...
01:28:42,570 DEBUG [DefaultManagedObjectFactoryMap] Failed to find factory for event: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=94,timeStamp=1244568522569,message=null,userData=jboss.jca:service=WorkManagerThreadPool]
01:28:42,570 DEBUG [ServiceController] Creating dependent components for: jboss.jca:service=WorkManagerThreadPool dependents are: [ObjectName: jboss.jca:service=WorkManager
State: CONFIGURED
I Depend On:
jboss.jca:service=WorkManagerThreadPool
jboss:service=TransactionManager
Depends On Me:
jboss.jca:service=RARDeployer
]
01:28:42,570 DEBUG [ServiceController] Creating service jboss.jca:service=WorkManager
01:28:42,584 DEBUG [JBossWorkManager] Creating jboss.jca:service=WorkManager
01:28:42,584 DEBUG [JBossWorkManager] Created jboss.jca:service=WorkManager
01:28:42,584 DEBUG [LocalJBossServerDomain] handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=95,timeStamp=1244568522584,message=null,userData=jboss.jca:service=WorkManager]
01:28:42,585 DEBUG [DefaultManagedObjectFactoryMap] Failed to find factory for event: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=95,timeStamp=1244568522584,message=null,userData=jboss.jca:service=WorkManager]
01:28:42,585 DEBUG [ServiceController] Creating dependent components for: jboss.jca:service=WorkManager dependents are: [ObjectName: jboss.jca:service=RARDeployer
State: CONFIGURED
I Depend On:
jboss.jca:service=WorkManager
jboss:service=TransactionManager
]
01:28:42,585 DEBUG [ServiceController] Creating service jboss.jca:service=RARDeployer
01:28:42,585 DEBUG [RARDeployer] Creating jboss.jca:service=RARDeployer
01:28:42,604 DEBUG [RARDeployer] Created jboss.jca:service=RARDeployer
01:28:42,604 DEBUG [LocalJBossServerDomain] handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=96,timeStamp=1244568522604,message=null,userData=jboss.jca:service=RARDeployer]
01:28:42,605 DEBUG [ServiceController] Creating dependent components for: jboss.jca:service=RARDeployer dependents are: []
01:28:42,605 DEBUG [ServiceController] Creating service jboss.jca:service=WorkManager
01:28:42,605 DEBUG [ServiceController] Ignoring create request for service: jboss.jca:service=WorkManager
01:28:42,605 DEBUG [ServiceController] Creating service jboss.jca:service=RARDeployer
01:28:42,606 DEBUG [ServiceController] Ignoring create request for service: jboss.jca:service=RARDeployer
01:28:42,606 DEBUG [ServiceController] Creating service jboss.jca:service=ConnectionFactoryDeployer
after the above line there is no activity happening in the machine neither JBOSS starts completely neither we can take thread dump...
Any help or suggestion would of great use
Thanks in Advance
JBOSS USER
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4237251#4237251
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4237251
17 years, 1 month