Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Hibernate Mapping File not found
|
Re: Hibernate Mapping File not found [message #113395 is a reply to message #113337] |
Tue, 26 February 2008 19:46 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Daniel,
Teneo expects the mapping file to be in the classpath (as a classpath resource), so the direct path
to a file on your c-drive won't work, you have to use a classpath resource notation, for example:
/org/eclipse/emf/teneo/hibernate/test/emf/test.hbm.xml
when you put the hbm file in the source tree make sure that the build.properties of the plugin copy
the hbm file to the output directory.
gr. Martin
Daniel Gerlach wrote:
> Hi,
>
> i want to use two different mapping files. So i defined the
> PersistenceOptions.MAPPING_FILE_PATH,
> " C:/Users/gerlacdt/workspace/BpelFragmentMining/hibernate2.hb m.xml "). I
> tried the absolute path and a relative one, but i always get this
> exception:
>
> org.eclipse.emf.teneo.hibernate.HbStoreException: Path to mapping file:
> C:/Users/gerlacdt/workspace/BpelFragmentMining/hibernate2.hb m.xml does
> not exist!
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:160)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:74)
>
> at
> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:55)
>
> at
> de.uni.stuttgart.gerlacdt.bpel.database.PostgresqlConfigurat ionFragments. <init>(PostgresqlConfigurationFragments.java:24)
>
> at test.DatabaseTest1.createFragmentsTables(DatabaseTest1.java: 46)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> ...
>
> Is there a special notation for defining the resource path? I saw that
> the mapping file is loaded in HbSessionDataStore.class.mapmodel()
> method. But my InputStream "is" is always null.
>
> Code:
>
> final InputStream is = this.getClass().getResourceAsStream(element);
>
> Thanks in advance,
>
> Daniel Gerlach
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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: Hibernate Mapping File not found [message #113419 is a reply to message #113395] |
Wed, 27 February 2008 08:24 |
Daniel Gerlach Messages: 36 Registered: July 2009 |
Member |
|
|
Hi Martin,
thanks, now it works. I put the new mapping file in the Project/src/
folder. And set
persistenceOptions.setProperty(PersistenceOptions.MAPPING_FI LE_PATH,
"/hibernate2.hbm.xml");
My fault was that i omitted the "/" in front of "hibernate2.hbm.xml".
Greetings
Daniel Gerlach
Martin Taal schrieb:
> Hi Daniel,
> Teneo expects the mapping file to be in the classpath (as a classpath
> resource), so the direct path to a file on your c-drive won't work, you
> have to use a classpath resource notation, for example:
> /org/eclipse/emf/teneo/hibernate/test/emf/test.hbm.xml
>
> when you put the hbm file in the source tree make sure that the
> build.properties of the plugin copy the hbm file to the output directory.
>
> gr. Martin
>
> Daniel Gerlach wrote:
>> Hi,
>>
>> i want to use two different mapping files. So i defined the
>> PersistenceOptions.MAPPING_FILE_PATH,
>> " C:/Users/gerlacdt/workspace/BpelFragmentMining/hibernate2.hb m.xml ").
>> I tried the absolute path and a relative one, but i always get this
>> exception:
>>
>> org.eclipse.emf.teneo.hibernate.HbStoreException: Path to mapping
>> file:
>> C:/Users/gerlacdt/workspace/BpelFragmentMining/hibernate2.hb m.xml does
>> not exist!
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:160)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:74)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:55)
>>
>> at
>> de.uni.stuttgart.gerlacdt.bpel.database.PostgresqlConfigurat ionFragments. <init>(PostgresqlConfigurationFragments.java:24)
>>
>> at test.DatabaseTest1.createFragmentsTables(DatabaseTest1.java: 46)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> ...
>>
>> Is there a special notation for defining the resource path? I saw that
>> the mapping file is loaded in HbSessionDataStore.class.mapmodel()
>> method. But my InputStream "is" is always null.
>>
>> Code:
>>
>> final InputStream is = this.getClass().getResourceAsStream(element);
>>
>> Thanks in advance,
>>
>> Daniel Gerlach
>>
>
>
|
|
|
Re: Hibernate Mapping File not found [message #615572 is a reply to message #113337] |
Tue, 26 February 2008 19:46 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Daniel,
Teneo expects the mapping file to be in the classpath (as a classpath resource), so the direct path
to a file on your c-drive won't work, you have to use a classpath resource notation, for example:
/org/eclipse/emf/teneo/hibernate/test/emf/test.hbm.xml
when you put the hbm file in the source tree make sure that the build.properties of the plugin copy
the hbm file to the output directory.
gr. Martin
Daniel Gerlach wrote:
> Hi,
>
> i want to use two different mapping files. So i defined the
> PersistenceOptions.MAPPING_FILE_PATH,
> " C:/Users/gerlacdt/workspace/BpelFragmentMining/hibernate2.hb m.xml "). I
> tried the absolute path and a relative one, but i always get this
> exception:
>
> org.eclipse.emf.teneo.hibernate.HbStoreException: Path to mapping file:
> C:/Users/gerlacdt/workspace/BpelFragmentMining/hibernate2.hb m.xml does
> not exist!
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:160)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:74)
>
> at
> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:55)
>
> at
> de.uni.stuttgart.gerlacdt.bpel.database.PostgresqlConfigurat ionFragments. <init>(PostgresqlConfigurationFragments.java:24)
>
> at test.DatabaseTest1.createFragmentsTables(DatabaseTest1.java: 46)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> ...
>
> Is there a special notation for defining the resource path? I saw that
> the mapping file is loaded in HbSessionDataStore.class.mapmodel()
> method. But my InputStream "is" is always null.
>
> Code:
>
> final InputStream is = this.getClass().getResourceAsStream(element);
>
> Thanks in advance,
>
> Daniel Gerlach
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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: Hibernate Mapping File not found [message #615574 is a reply to message #113395] |
Wed, 27 February 2008 08:24 |
Daniel Gerlach Messages: 36 Registered: July 2009 |
Member |
|
|
Hi Martin,
thanks, now it works. I put the new mapping file in the Project/src/
folder. And set
persistenceOptions.setProperty(PersistenceOptions.MAPPING_FI LE_PATH,
"/hibernate2.hbm.xml");
My fault was that i omitted the "/" in front of "hibernate2.hbm.xml".
Greetings
Daniel Gerlach
Martin Taal schrieb:
> Hi Daniel,
> Teneo expects the mapping file to be in the classpath (as a classpath
> resource), so the direct path to a file on your c-drive won't work, you
> have to use a classpath resource notation, for example:
> /org/eclipse/emf/teneo/hibernate/test/emf/test.hbm.xml
>
> when you put the hbm file in the source tree make sure that the
> build.properties of the plugin copy the hbm file to the output directory.
>
> gr. Martin
>
> Daniel Gerlach wrote:
>> Hi,
>>
>> i want to use two different mapping files. So i defined the
>> PersistenceOptions.MAPPING_FILE_PATH,
>> " C:/Users/gerlacdt/workspace/BpelFragmentMining/hibernate2.hb m.xml ").
>> I tried the absolute path and a relative one, but i always get this
>> exception:
>>
>> org.eclipse.emf.teneo.hibernate.HbStoreException: Path to mapping
>> file:
>> C:/Users/gerlacdt/workspace/BpelFragmentMining/hibernate2.hb m.xml does
>> not exist!
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:160)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:74)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbBaseSessionDataStore.getSe ssionFactory(HbBaseSessionDataStore.java:55)
>>
>> at
>> de.uni.stuttgart.gerlacdt.bpel.database.PostgresqlConfigurat ionFragments. <init>(PostgresqlConfigurationFragments.java:24)
>>
>> at test.DatabaseTest1.createFragmentsTables(DatabaseTest1.java: 46)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> ...
>>
>> Is there a special notation for defining the resource path? I saw that
>> the mapping file is loaded in HbSessionDataStore.class.mapmodel()
>> method. But my InputStream "is" is always null.
>>
>> Code:
>>
>> final InputStream is = this.getClass().getResourceAsStream(element);
>>
>> Thanks in advance,
>>
>> Daniel Gerlach
>>
>
>
|
|
|
Goto Forum:
Current Time: Fri Mar 29 13:36:58 GMT 2024
Powered by FUDForum. Page generated in 0.03901 seconds
|