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.  [ 9 posts ] 
Author Message
 Post subject: hibernate-configuration documentation?
PostPosted: Tue Jul 13, 2004 8:49 am 
Beginner
Beginner

Joined: Sun Oct 12, 2003 2:14 pm
Posts: 25
Location: Zagreb, Croatia
Hi,

where can I find documentation for hibernate.cfg.xml, I am looking for description of:

<!ELEMENT mapping EMPTY> <!-- reference to a mapping file -->
<!ATTLIST mapping resource CDATA #IMPLIED>
<!ATTLIST mapping file CDATA #IMPLIED>
<!ATTLIST mapping jar CDATA #IMPLIED>

Basicly, how to use file and jar attributes?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 13, 2004 12:50 pm 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
http://www.hibernate.org/hib_docs/refer ... -xmlconfig
There is a sample on the page, much easier then the DTD.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 3:25 am 
Beginner
Beginner

Joined: Sun Oct 12, 2003 2:14 pm
Posts: 25
Location: Zagreb, Croatia
This is for resource element, and what when is file, does is file mean directory, and what with jar, should all files be in jar without directory structure?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 3:49 am 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
The mappings can be inside a directory structure.
These can be inside a jar file. I haven't used a jar definition inside the config file so far.
I used something like:
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory
name="java:comp/env/hibernate/SessionFactory">

<!-- properties -->
<property name="connection.datasource">java:/PostgresDS</property>
<property name="jndi.url">192.168.100.52:1099</property>
<property name="jndi.class">org.jnp.interfaces.NamingContextFactory</property>
<property name="connection.username">postgres</property>
<property name="show_sql">true</property>
<property name="use_outer_join">true</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="dialect">net.sf.hibernate.dialect.PostgreSQLDialect</property>
<mapping resource="de/xcom/ticketsystem/hibernate/or/UserProfile.hbm.xml" />
<mapping resource="de/xcom/ticketsystem/hibernate/or/Attachment.hbm.xml" />
<mapping resource="de/xcom/ticketsystem/hibernate/or/Category.hbm.xml" />
<mapping
</session-factory>
</hibernate-configuration>
These mappings I put into a jar file with the directory structure, else they won't be found.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 30, 2004 3:31 am 
Beginner
Beginner

Joined: Wed Mar 03, 2004 6:02 am
Posts: 46
Location: Kuala Lumpur, Malaysia
How do you declare interceptors in hibernate.cfg.xml file ?

Thanks

A


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 10:33 am 
Newbie

Joined: Wed Aug 04, 2004 6:19 am
Posts: 9
Hi,

I am having the same problem. There is some documentation missing.
E.g. a list of all possible <session-factory> properties is missing.

So far my hibernate.cfg.xml looks like that:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

<session-factory>
<property name="dialect">net.sf.hibernate.dialect.DB2Dialect</property>
<!--<property name="hibernate.default_schema">dbo</property> -->
<property name="connection.driver_class">COM.ibm.db2.jdbc.app.DB2Driver</property>
<property name="connection.username">ifb</property>
<property name="connection.password">kennwort</property>
<property name="connection.url">jdbc:db2:test</property>
<property name="jdbc.batch_size">1000</property>
<property name="show_sql">false</property>

<!-- Mapping files -->
<mapping resource="hibernate/User.hbm.xml"/>

</session-factory>

</hibernate-configuration>

Yours,


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 10:37 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Thats because they are the same as in hibernate.properties.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 12:14 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
alistair wrote:
How do you declare interceptors in hibernate.cfg.xml file ?


There is not way to set the interceptors via the hibernate.cfg.xml. I set the interceptor at the sessionFactory level when reading my configuration.

Code:
        // Initialize the Hibernate configuration
        Configuration config = new Configuration().configure( new File( hibernateConfigFile ) );
        if ( interceptor != null )
            {
            config.setInterceptor( interceptor );
            }

_________________
Matt Veitas


Top
 Profile  
 
 Post subject: hibernate properties file
PostPosted: Wed Sep 08, 2004 8:44 pm 
Newbie

Joined: Mon Sep 06, 2004 3:11 pm
Posts: 8
How can I set a mapping resource in the properties file, not XML file?


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