-->
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.  [ 10 posts ] 
Author Message
 Post subject: where do I put hibernate.properties? in jar, sar, etc?
PostPosted: Tue Jul 27, 2004 1:26 pm 
Newbie

Joined: Tue Jul 27, 2004 1:17 pm
Posts: 12
I get this error when I run which implies that my hibernate.properties has not been recognized...i.e. I put it in the wrong place.

net.sf.hibernate.connection.UserSuppliedConnectionProvider#configure No connection properties specified - the user must supply JDBC connections

I'm running hibernate2.1 and jboss.3.2.3. and here is my hibernate.properties:

hibernate.dialect net.sf.hibernate.dialect.Oracle9Dialect
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
hibernate.connection.url jdbc:oracle:thin:@localhost:1521:bmcs
hibernate.connection.username foo
hibernate.connection.password bar
hibernate.show_sql true

I've put copies of this file at the top level of my hibernateStartup.sar and at the top level of the jar for my session bean.

Any pointers would be appreciated.

Brian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 27, 2004 5:51 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
The Hibernate MBEan is not configured through a hibernate.properties. Please have a look at the JBoss documentation page in the Wiki.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 27, 2004 5:57 pm 
Newbie

Joined: Tue Jul 27, 2004 1:17 pm
Posts: 12
I'm actually trying to configure my class as opposed to the Hibernate MBean. The mbean seems to be fine.

What I've tried is just putting the hibernate.properties directly into the jboss/server/default/deploy directory....and this worked. The file got deployed and my test case successfully called my session bean which called the pojo which hibernated itself into the database.

I'm still a bit puzzled why my hibernate pojo class (which was deployed inside a jar) did not find the hibernate.properties when I put it inside the jar.

Perhaps I'm missing a basic concept? (I did read the jboss doc on the wiki but it kind of skimmed over hibernate.properties. I also tried to configure the connection via the jmx console but still got the 'no connection info' error).

Thank you.

Brian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 27, 2004 11:27 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
The hibernate.properties is used for configuring the session factory, so the POJO class has nothing to do with it.

IMHO, the MBean is the easiest way to go for JBoss.


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 9:16 am 
Newbie

Joined: Tue Jul 27, 2004 1:17 pm
Posts: 12
Ok, I like mbeans and jmx...but how do I setup the system so it 'just works' after installation, i.e. without requiring the using to use the jmx-console to configure the connection properties? I know the correct values and ought to be able to preload them. Can I do that somehow via the mbean as opposed to via hibernate.properties? (thank you).

Brian Tarbox


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 12:18 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
http://www.hibernate.org/66.html

This will produce a SAR that you can drop into the JBoss deployment direcotry or include in an EAR. JBoss will deploy the SAR and you will have a SessionFactory in JNDI...


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 1:34 pm 
Newbie

Joined: Tue Jul 27, 2004 1:17 pm
Posts: 12
I have read that document, and its great but not complete.

I created the sar and deployed it..and still got 'no connection info found' until I included hibernate.properties.

Using just the sar where can I specify connection properties such as user and password (remember, I want this to work out of the box)?

Thank you.

Brian


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 9:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The configuration (as document on the above URL) uses the containers configured datasource. The datasource configuration has the user and password etc. JBoss has a number of examples that you can used as a starting point.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 05, 2004 11:14 am 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
Take the default-ds.xml and edit it to your needs afterwards save it as you like and put this name into your bean descriptor.

regards

Olaf

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 13, 2004 5:49 pm 
Newbie

Joined: Thu Aug 12, 2004 4:09 pm
Posts: 5
Location: San Francisco, CA
If using JBoss 3.2.6 you can use a hibernate archive
Here is a sample .har layout
foo.har/
---User.hbm.xml
---Role.hbm.xml
---META-INF/
------hibernate-service.xml
---com/
------foo/
---------model/
------------User.class
------------Role.class



Sample hibernate-service.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>
<server>
    <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=fooapp-hibernate">
                <depends>jboss.jca:service=RARDeployer</depends>
        <!-- so it won't deploy until the datasrouce is available -->
        <depends>jboss.jca:service=LocalTxCM,name=fooappDS</depends>

        <attribute name="DatasourceName">java:/fooappDS</attribute>
        <attribute name="SessionFactoryName">java:/fooapp/hibernate/SessionFactory</attribute>
        <attribute name="Dialect">net.sf.hibernate.dialect.MySQLDialect</attribute>
        <attribute name="CacheProviderClass">net.sf.ehcache.hibernate.Provider</attribute>
        <attribute name="QueryCacheEnabled">true</attribute>
        <attribute name="ShowSqlEnabled">true</attribute>
        <attribute name="MaxFetchDepth">1</attribute>
    </mbean>

</server>


btarbox wrote:
I have read that document, and its great but not complete.

I created the sar and deployed it..and still got 'no connection info found' until I included hibernate.properties.

Using just the sar where can I specify connection properties such as user and password (remember, I want this to work out of the box)?

Thank you.

Brian
Code:


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