Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » passing a hibernate.cfg.xml to teneo
passing a hibernate.cfg.xml to teneo [message #431503] Tue, 14 July 2009 12:24 Go to next message
Alex Gfeller is currently offline Alex GfellerFriend
Messages: 490
Registered: July 2009
Senior Member
Dear Martin, dear all,

I would like to use hibernate search for some reason. As we can not work
with annotations,
we have to configured the corresponding listeners in the hibernate.cfg.xml.

In my application, I initializing teneo like this (using spring):

<!-- Teneo Session Factory -->
<bean id="sessionFactory"
class="org.eclipse.emf.teneo.hibernate.HbSessionDataStore"
init-method="initialize">
<property name="name" value="hbDataStore" />
<property name="properties">
<props>
<prop
key="hibernate.connection.datasource">java:/comp/env/jdbc/arts </prop>
<prop
key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect </prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="teneo.mapping.mapping_file_name">/hibernate.hbm.xml</prop >
<prop key="hibernate.search.default.indexBase">c:/tmp/index</prop >
</props>
</property>
<property name="EPackageClasses">
<list>
<value>com.inventage.emf.ebo.impl.EboPackageImpl</value>
<value>com.swissfinancial.arts.model.base.impl.BasePackageImpl </value>
<value>com.swissfinancial.arts.model.fund.impl.FundPackageImpl </value>
</list>
</property>
</bean>

<!-- Transaction Manager -->
<bean id="transactionManager"
class=" org.springframework.orm.hibernate3.HibernateTransactionManag er "
p:sessionFactory-ref="sessionFactory" />

Now my question:
How can I tell teneo to load the hibernate stuff out of my
hibernate.cfg.xml? I looked around in the
news groups but couldn't find anything really helpful!

Thanks for your help,
Alex
Re: passing a hibernate.cfg.xml to teneo [message #431504 is a reply to message #431503] Tue, 14 July 2009 12:42 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Alex,
I would expect that it is picked up automatically when the file is in the root of the classpath. Are you sure that the
cfg.xml is present in the root of the classpath? Often to get this done such a file needs to be explicitly added to the
build.properties or not excluded in the source folder (non-plugin projects).

gr. Martin

Alex Gfeller wrote:
> Dear Martin, dear all,
>
> I would like to use hibernate search for some reason. As we can not work
> with annotations,
> we have to configured the corresponding listeners in the hibernate.cfg.xml.
>
> In my application, I initializing teneo like this (using spring):
>
> <!-- Teneo Session Factory -->
> <bean id="sessionFactory"
> class="org.eclipse.emf.teneo.hibernate.HbSessionDataStore"
> init-method="initialize">
> <property name="name" value="hbDataStore" />
> <property name="properties">
> <props>
> <prop
> key="hibernate.connection.datasource">java:/comp/env/jdbc/arts </prop>
> <prop
> key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect </prop>
> <prop key="hibernate.hbm2ddl.auto">update</prop>
> <prop
> key="teneo.mapping.mapping_file_name">/hibernate.hbm.xml</prop >
> <prop
> key="hibernate.search.default.indexBase">c:/tmp/index</prop >
> </props>
> </property>
> <property name="EPackageClasses">
> <list>
> <value>com.inventage.emf.ebo.impl.EboPackageImpl</value>
>
> <value>com.swissfinancial.arts.model.base.impl.BasePackageImpl </value>
>
> <value>com.swissfinancial.arts.model.fund.impl.FundPackageImpl </value>
> </list>
> </property>
> </bean>
>
> <!-- Transaction Manager -->
> <bean id="transactionManager"
> class=" org.springframework.orm.hibernate3.HibernateTransactionManag er "
> p:sessionFactory-ref="sessionFactory" />
>
> Now my question:
> How can I tell teneo to load the hibernate stuff out of my
> hibernate.cfg.xml? I looked around in the
> news groups but couldn't find anything really helpful!
>
> Thanks for your help,
> Alex
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: passing a hibernate.cfg.xml to teneo [message #431505 is a reply to message #431504] Tue, 14 July 2009 12:53 Go to previous messageGo to next message
Alex Gfeller is currently offline Alex GfellerFriend
Messages: 490
Registered: July 2009
Senior Member
Hi Martin,

Yes, the file is in the root of my classpath. We run teneo in a web app
and we have placed the file in the WEB-INF/classes subfolder.

Can you give me a hint, where I could start debugging? (somewhere in the
HbSessionDataStore..)?

I see an other potential problem: Some of the hibernate properties are
passed as configuration to the HbSessionDataStore (see pervious post) and
some would then be in the hibernate.cfg.xml. Would it make sense to put
everything to the hibernate.cfg.xml and pass only the epackages directly
to the HbSessionDataStore?

Thanks for your help,
Alex
Re: passing a hibernate.cfg.xml to teneo [message #431506 is a reply to message #431505] Tue, 14 July 2009 13:13 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Alex,
Yes it is possible that the way Teneo creates the configuration interferes, although I did not expect it.

Yes in the HbSessionDataStore there is a createConfiguration method. It is best to also have the hibernate sources
available so you can debug into them. I often manually add the java source files to the hibernate jar file to be sure
that they are available.

Let me know if you find something special! I am open to suggestions if it eases configuration.

gr. Martin

Alex Gfeller wrote:
> Hi Martin,
>
> Yes, the file is in the root of my classpath. We run teneo in a web app
> and we have placed the file in the WEB-INF/classes subfolder.
>
> Can you give me a hint, where I could start debugging? (somewhere in the
> HbSessionDataStore..)?
>
> I see an other potential problem: Some of the hibernate properties are
> passed as configuration to the HbSessionDataStore (see pervious post)
> and some would then be in the hibernate.cfg.xml. Would it make sense to
> put everything to the hibernate.cfg.xml and pass only the epackages
> directly to the HbSessionDataStore?
>
> Thanks for your help,
> Alex
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:Refer to an EAttribute of a different model
Next Topic:Copy of generated model
Goto Forum:
  


Current Time: Mon Dec 09 23:12:20 GMT 2019

Powered by FUDForum. Page generated in 0.01455 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top