-->
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.  [ 6 posts ] 
Author Message
 Post subject: hibernate 2 ajnd JBoss
PostPosted: Tue Aug 26, 2003 10:30 am 
Newbie

Joined: Tue Aug 26, 2003 10:19 am
Posts: 3
Hallo, I tried to use hibernate with jboss with your example, but jboss tells that do not have hibernate.cfg.xml.

As I understand, using jboss-service.xml is instead of hibernate.cfg.xml- did I understood well?

I have datasource defined in jboss:
<local-tx-datasource>
<jndi-name>OraHbDS</jndi-name>
<connection-url>jdbc:oracle:thin:@chaloupkaj.iccc.cz:1521:ordb</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>hb</user-name>
<password>oracle</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
</local-tx-datasource>

, *.sar/META-INF/jboss-service.xml:
<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=OraHbDS</depends>
<!-- Make it deploy ONLY after DataSource had been started -->
<attribute name="MapResources">mappings/cat.hbm.xml</attribute>
<attribute name="JndiName">java:/hibernate/HibernateFactory</attribute>
<attribute name="Datasource">java:/OraHbDS</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.Oracle9Dialect</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">java:/UserTransaction</attribute>
</mbean>
</server>

and mapp file *.sar/mappings/cat.hbm.xml

in code I have only session factory creation, for now.

What I understood bad?
Thanks, Jirk


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2003 12:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
If you are using JMX, you should not need .cfg.xml


I'm not sure what you mean by "Hibernate tells me". What does it tell you?? When??


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2003 1:53 pm 
Newbie

Joined: Tue Aug 26, 2003 10:19 am
Posts: 3
code:
try{
SessionFactory sessionFactory =
new Configuration().configure().buildSessionFactory();
}catch(Exception e){
out.println("Fail: "+e.getMessage());
}

prints :
Fail: /hibernate.cfg.xml not found

gavin wrote:
If you are using JMX, you should not need .cfg.xml


I'm not sure what you mean by "Hibernate tells me". What does it tell you?? When??


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2003 2:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You don't need to use Configuration when using JMX. The MBean does all that stuff for you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 27, 2003 4:14 am 
Newbie

Joined: Tue Aug 26, 2003 10:19 am
Posts: 3
I think I do not understand, documentation seems not unambiguous here.
In classical jboss I have connection from datasource:
DataSource ds = (DataSource) ctx.lookup("java:/someDS");
Connection conn = ds.getConnection();
etc etc. (via jdbc)
You tell that it is sufficient and hibernate manages this connection now? I do not think :(

gavin wrote:
You don't need to use Configuration when using JMX. The MBean does all that stuff for you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 27, 2003 4:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Apparently you know much better than me, so you shouldn't ask me any more questions.


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