-->
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.  [ 14 posts ] 
Author Message
 Post subject: Hibernate with Jboss, hibernate-service.xml
PostPosted: Sun Jun 13, 2004 7:48 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
I want to configure Jboss for work with hibernate, I have a file hibernate-service.xml that contains:

<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,
name=HibernateFactory">
<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=SigmaDS</depends>
<!-- Make it deploy ONLY after DataSource had been started -->
<attribute name="MapResources">/mappings/Usuario.hbm.xml</attribute>
<attribute name="JndiName">java:/hibernate/HibernateFactory</attribute>
<attribute name="Datasource">java:/SigmaDS</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.PostgreSQLDialect</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
<attribute name="UseOuterJoin">false</attribute>
<attribute name="ShowSql">false</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
</mbean>
</server>

and a file persistent-classes.jar that contains the file Usuario.hbm.xml in /server/default/deploy, but when I run service Jboss the following error appears:


18:43:54,802 INFO [HibernateServiceMBean] starting service at JNDI name: java:/hibernate/HibernateFactory
18:43:54,802 INFO [HibernateServiceMBean] service properties: {hibernate.session_factory_name=java:/hibernate/HibernateFactory, hibernate.transaction.manager_lookup_class=net.sf.hibernate.transaction.JBossTransactionManagerLookup, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.show_sql=false, hibernate.use_outer_join=false, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory, hibernate.connection.datasource=java:/SigmaDS, jta.UserTransaction=UserTransaction}
18:43:54,802 INFO [Configuration] Mapping resource: /mappings/Usuario.hbm.xml
18:43:54,812 ERROR [Engine] StandardWrapperValve[Prueba]: Servlet.service() for servlet Prueba threw exception
net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem
at net.sf.hibernate.jmx.SessionFactoryStub.getImpl(SessionFactoryStub.java:77)
at net.sf.hibernate.jmx.SessionFactoryStub.openSession(SessionFactoryStub.java:62)
at co.edu.escuelaing.Servlets.PruebaServlet.doProcess(PruebaServlet.java:61)
at co.edu.escuelaing.Servlets.PruebaServlet.doPost(PruebaServlet.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:536)
Caused by: net.sf.hibernate.MappingException: Resource: /mappings/Usuario.hbm.xml not found
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:313)
at net.sf.hibernate.jmx.HibernateService.buildSessionFactory(HibernateService.java:174)
at net.sf.hibernate.jmx.SessionFactoryStub.getImpl(SessionFactoryStub.java:74)
... 44 more

Somebody can help me?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 13, 2004 7:51 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
While using the hibernate 2.1.4 with JBoss i am getting the above error
cannot instantiate net.sf.ehcache.hibernate.Provider: Hibernate exception

please help me

Thanks!!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2004 6:28 am 
Newbie

Joined: Tue Jun 15, 2004 6:22 am
Posts: 3
Hello marcelitano,

as I can see the key in the stack you provided is:

Caused by: net.sf.hibernate.MappingException: Resource: /mappings/Usuario.hbm.xml not found

and that's because the deployer cannot find this file in the deploy directory.
You can solve this in several ways but I prefer to keep all hibernate META-INF inside a sar file.

you can try creating an structure like this inside your deploy directory:

hibernate.sar/META-INF/jboss-service.xml where this file is your hibernate-service.xml
hibernate.sar/mapping/Usuario.hbm.xml

I'm working with this configuration and it works for me. I hope this will be useful for your purposes ;).

Dave Garcia

daveg@argus.es


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 17, 2004 2:38 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
Hello!
Thanks for reply!!!

I already have the following structure inside hibernate.sar:

org/mytest/objects/Usuario.class
mappings/Usuario.hbm.xml
META-INF/jboss-service.xml

and jboss-service.xml like this:

<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,
name=HibernateFactory">
<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=SigmaDS</depends>
<!-- Make it deploy ONLY after DataSource had been started -->
<attribute name="MapResources">mappings/Usuario.hbm.xml</attribute>
<attribute name="JndiName">java:/hibernate/HibernateFactory</attribute>
<attribute name="Datasource">java:/SigmaDS</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.PostgreSQLDialect</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
<attribute name="UseOuterJoin">false</attribute>
<attribute name="ShowSql">false</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
</mbean>
</server>

But the problem is that when I run the Jboss server appears
Could not build SessionFactory will try ......: resources mappings/Usuario.hbm.xml, so when I get Usuario from the database this exception is NullPointer and I don't know why???.

Marcela Moreno


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 18, 2004 9:16 am 
Newbie

Joined: Fri Jun 18, 2004 9:11 am
Posts: 1
Hi marcelitamo.

Try by removing the slash infront of your mapping reference. Like this:

From:

<attribute name="MapResources">/mappings/Usuario.hbm.xml</attribute>

To:

<attribute name="MapResources">mappings/Usuario.hbm.xml</attribute>



I'll guess it will fix it.

Roy


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 19, 2004 5:17 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
hello!!!

I already solved the problem, Thanks!, but now I have another problem, maybe anybody can help me.

I have this servlet:

protected void doProcess(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();

SessionFactory sessionFactory;
Configuration config;
Session session;

try{
InitialContext context = new InitialContext();
sessionFactory = (SessionFactory)context.lookup("java:/hibernate/HibernateFactory");
config = new Configuration();
config.addClass(Persona.class);
sessionFactory = config.buildSessionFactory();
session = sessionFactory.openSession();
Persona p = (Persona)session.get(Persona.class,new Integer("52717995"));
if(p!=null){
out.println(p.toString());
}
else{
out.println("Nula");
}
}
catch(Exception e){
out.println("Error:"+e.toString());
}

}
}

When I run Jboss server, already take the properties of hibernate, but when I launch my application appears this exception:

Error:java.lang.UnsupportedOperationException: The user must supply a JDBC connection

and in the console appears:

15:52:26,815 INFO [Configuration] Mapping resource: Persona/Persona.hbm.xml
15:52:26,915 INFO [Binder] Mapping class: Persona.Persona -> persona
15:52:26,915 INFO [Configuration] processing one-to-many association mappings
15:52:26,925 INFO [Configuration] processing one-to-one association property references
15:52:26,925 INFO [Configuration] processing foreign key constraints
15:52:26,925 WARN [SettingsFactory] No dialect set - using GenericDialect: The dialect was not set. Set the property hibernate.dialect.
15:52:26,925 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.GenericDialect
15:52:26,925 INFO [SettingsFactory] Use outer join fetching: false
15:52:26,925 WARN [UserSuppliedConnectionProvider] No connection properties specified - the user must supply JDBC connections
15:52:26,925 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
15:52:26,925 INFO [SettingsFactory] Use scrollable result sets: false
15:52:26,925 INFO [SettingsFactory] Use JDBC3 getGeneratedKeys(): false
15:52:26,925 INFO [SettingsFactory] Optimize cache for minimal puts: false
15:52:26,925 INFO [SettingsFactory] Query language substitutions: {}
15:52:26,925 INFO [SettingsFactory] cache provider: net.sf.ehcache.hibernate.Provider
15:52:26,925 INFO [Configuration] instantiating and configuring caches
15:52:26,925 INFO [SessionFactoryImpl] building session factory
15:52:27,015 INFO [SessionFactoryObjectFactory] no JNDI name configured

Thanks!!!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 21, 2004 7:58 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
The MBean does all the configuration. Try:

InitialContext context = new InitialContext();
sessionFactory = (SessionFactory)context.lookup("java:/hibernate/HibernateFactory");
session = sessionFactory.openSession();


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 23, 2004 12:45 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
Thanks!!! Sherman:

I already solved the problem, but now I have another problem.
When I launch my aplication and I get the object, this is null.

In the console appears this:

11:28:24,573 INFO [STDOUT] Hibernate: select persona0_.cedula as cedula0_, persona0_.nombre as nombre0_, persona0_.telefono as telefono0_ from persona persona0_ where persona0_.cedula=?
11:28:49,559 WARN [SessionImpl] unclosed connection

My servlet:

InitialContext context = new InitialContext();
sessionFactory = (SessionFactory)context.lookup("java:/hibernate/HibernateFactory");
session = sessionFactory.openSession();
Persona p = (Persona)session.get(Persona.class,new Integer("52717995"));

Thanks!!!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 23, 2004 2:20 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
Did you deploy the MBean?

Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 25, 2004 7:09 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
Thanks!!!

I'm working with Eclipse. I run Jboss server, deploy my application and show in browser and appears the problem mentioned previously.
I believe that the error is in the file Persona.hbm.xml, but I have not been to find the error.
Look, my file Persona.hbm.xml:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="Persona.Persona" table="persona">
<id name="cedula" column="cedula" >
<generator class="assigned" />
</id>
<property name="nombre"/>
<property name="telefono"/>
</class>
</hibernate-mapping>

Thanks for help me!!!

Marcela Moreno


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 25, 2004 9:45 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
sgwood wrote:
Did you deploy the MBean?
Sherman


You did not answer me.

Did you put the Hibernate MBean in the JBoss deployment directory?

Do you see it deploying in the server.log? You should see entries like:

2004-06-25 06:03:52,625 INFO [net.sf.hibernate.jmx.HibernateServiceMBean] starting service at JNDI name: java:/LumenaHibernateFactory3
2004-06-25 06:03:52,625 INFO [net.sf.hibernate.jmx.HibernateServiceMBean] service properties: {hibernate.session_factory_name=java:/LumenaHibernateFactory3, hibernate.transaction.manager_lookup_class=net.sf.hibernate.transaction.JBossTransactionManagerLookup, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.show_sql=false, hibernate.use_outer_join=true, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory, hibernate.connection.datasource=java:/Hibernate3, jta.UserTransaction=UserTransaction}
2004-06-25 06:03:52,687 INFO [net.sf.hibernate.cfg.Environment] Hibernate 2.1.2
2004-06-25 06:03:52,687 INFO [net.sf.hibernate.cfg.Environment] hibernate.properties not found
2004-06-25 06:03:52,687 INFO [net.sf.hibernate.cfg.Environment] using CGLIB reflection optimizer
2004-06-25 06:03:52,703 INFO [net.sf.hibernate.cfg.Configuration] Mapping resource: com/semanticworks/lumena/test/crossreference/hibernate/ItemMasterItem.hbm.xml
2004-06-25 06:03:52,875 INFO [net.sf.hibernate.cfg.Binder] Mapping class: com.semanticworks.lumena.test.crossreference.hibernate.ItemMasterItem -> ItemMasterItem

...

2004-06-25 06:03:53,578 INFO [net.sf.hibernate.dialect.Dialect] Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
2004-06-25 06:03:53,578 INFO [net.sf.hibernate.cfg.SettingsFactory] Use outer join fetching: true
2004-06-25 06:03:53,625 INFO [net.sf.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
2004-06-25 06:03:53,625 INFO [net.sf.hibernate.connection.DatasourceConnectionProvider] Using datasource: java:/Hibernate3
2004-06-25 06:03:53,640 INFO [net.sf.hibernate.transaction.TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JTATransactionFactory
2004-06-25 06:03:53,640 INFO [net.sf.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
2004-06-25 06:03:53,640 INFO [net.sf.hibernate.transaction.TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
2004-06-25 06:03:53,640 INFO [net.sf.hibernate.transaction.TransactionManagerLookupFactory] instantiated TransactionManagerLookup
2004-06-25 06:03:53,640 INFO [net.sf.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
2004-06-25 06:03:53,640 INFO [net.sf.hibernate.transaction.TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
2004-06-25 06:03:53,640 INFO [net.sf.hibernate.transaction.TransactionManagerLookupFactory] instantiated TransactionManagerLookup
2004-06-25 06:03:55,171 INFO [net.sf.hibernate.cfg.SettingsFactory] Use scrollable result sets: true
2004-06-25 06:03:55,171 INFO [net.sf.hibernate.cfg.SettingsFactory] Use JDBC3 getGeneratedKeys(): false
2004-06-25 06:03:55,171 INFO [net.sf.hibernate.cfg.SettingsFactory] Optimize cache for minimal puts: false
2004-06-25 06:03:55,171 INFO [net.sf.hibernate.cfg.SettingsFactory] Query language substitutions: {}
2004-06-25 06:03:55,171 INFO [net.sf.hibernate.cfg.SettingsFactory] cache provider: net.sf.ehcache.hibernate.Provider
2004-06-25 06:03:55,171 INFO [net.sf.hibernate.cfg.Configuration] instantiating and configuring caches
2004-06-25 06:03:55,281 INFO [net.sf.hibernate.impl.SessionFactoryImpl] building session factory
2004-06-25 06:03:55,812 INFO [net.sf.hibernate.impl.SessionFactoryObjectFactory] Factory name: java:/LumenaHibernateFactory3
2004-06-25 06:03:55,812 INFO [net.sf.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
2004-06-25 06:03:55,812 INFO [net.sf.hibernate.impl.SessionFactoryObjectFactory] Bound factory to JNDI name: java:/LumenaHibernateFactory3
2004-06-25 06:03:55,812 WARN [net.sf.hibernate.impl.SessionFactoryObjectFactory] InitialContext did not implement EventContext
2004-06-25 06:03:55,812 INFO [net.sf.hibernate.util.NamingHelper] JNDI InitialContext properties:{}

Note the factory name etc. This is what you should be looking up via your InitialContext.


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 4:04 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
Hello!!
Yes, I do.

Look:

14:57:18,238 INFO [HibernateServiceMBean] starting service at JNDI name: java:/hibernate/HibernateFactory
14:57:18,238 INFO [HibernateServiceMBean] service properties: {hibernate.session_factory_name=java:/hibernate/HibernateFactory, hibernate.transaction.manager_lookup_class=net.sf.hibernate.transaction.JBossTransactionManagerLookup, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.show_sql=true, hibernate.use_outer_join=false, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory, hibernate.connection.datasource=java:/SigmaDS, jta.UserTransaction=UserTransaction}
14:57:18,298 INFO [Environment] Hibernate 2.1.4
14:57:18,318 INFO [Environment] hibernate.properties not found
14:57:18,328 INFO [Environment] using CGLIB reflection optimizer
14:57:18,358 INFO [Configuration] Mapping resource: mappings/Persona.hbm.xml
14:57:19,310 INFO [Binder] Mapping class: Persona.Persona -> persona
14:57:19,650 INFO [Configuration] processing one-to-many association mappings
14:57:19,650 INFO [Configuration] processing one-to-one association property references
14:57:19,650 INFO [Configuration] processing foreign key constraints
14:57:19,750 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
14:57:19,760 INFO [SettingsFactory] Use outer join fetching: false
14:57:19,790 INFO [NamingHelper] JNDI InitialContext properties:{}
14:57:19,800 INFO [DatasourceConnectionProvider] Using datasource: java:/SigmaDS
14:57:19,810 INFO [TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JTATransactionFactory
14:57:19,960 INFO [NamingHelper] JNDI InitialContext properties:{}
14:57:19,960 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
14:57:20,041 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
14:57:20,041 INFO [NamingHelper] JNDI InitialContext properties:{}
14:57:20,041 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
14:57:20,041 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
14:57:20,732 INFO [SettingsFactory] Use scrollable result sets: true
14:57:20,732 INFO [SettingsFactory] Use JDBC3 getGeneratedKeys(): false
14:57:20,732 INFO [SettingsFactory] Optimize cache for minimal puts: false
14:57:20,732 INFO [SettingsFactory] echoing all SQL to stdout
14:57:20,732 INFO [SettingsFactory] Query language substitutions: {}
14:57:20,732 INFO [SettingsFactory] cache provider: net.sf.ehcache.hibernate.Provider
14:57:20,762 INFO [Configuration] instantiating and configuring caches
14:57:21,503 INFO [SessionFactoryImpl] building session factory
14:57:22,374 INFO [SessionFactoryObjectFactory] Factory name: java:/hibernate/HibernateFactory
14:57:22,374 INFO [NamingHelper] JNDI InitialContext properties:{}
14:57:22,374 INFO [NamingHelper] Creating subcontext: hibernate
14:57:22,374 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: java:/hibernate/HibernateFactory
14:57:22,374 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
14:57:22,374 INFO [NamingHelper] JNDI InitialContext properties:{}

Thanks!!!

Marcela Moreno


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 4:56 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
marcelitamo wrote:

11:28:24,573 INFO [STDOUT] Hibernate: select persona0_.cedula as cedula0_, persona0_.nombre as nombre0_, persona0_.telefono as telefono0_ from persona persona0_ where persona0_.cedula=?
11:28:49,559 WARN [SessionImpl] unclosed connection

Persona p = (Persona)session.get(Persona.class,new Integer("52717995"));



Does the SQL work if you run it directly against your DB? ie.

select persona0_.cedula as cedula0_, persona0_.nombre as nombre0_, persona0_.telefono as telefono0_ from persona persona0_ where persona0_.cedula=52717995

You have no types in your Hibernate mapping. I think everything defaults to String. Read the documentation on this.

Close your session when you finish.


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 8:07 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
Hello Sherman:

Thank you very much!!!
I already solved the problem, The problem was a silly thing, the method toString() of my class Persona was bad. The important thing is that it already works thanks to you.

Again, Thank you very much.

Any problem ask to you again.

Marcela Moreno.


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