Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Problem using generated hibernate mapping file
Problem using generated hibernate mapping file [message #94611] |
Tue, 28 August 2007 11:27 |
Daniel Gerlach Messages: 36 Registered: July 2009 |
Member |
|
|
Hello,
i want to use a self-generated mapping file because i have to change it a
litte.
My problem is that teneo don't find this file. I activated the
PersistenceOptions.USE_MAPPING_FILE,"true") and set the Properties in the
HbDataStore. My hibernate.hbm.xml is in the root of the classpath.
I also tried it with
PersistenceOptions.PERSISTENCE_XML,"absolutePath or relativePath ");
Both doesn't work.
I use teneo 0.8 and eclipse3.3. The hibernate.hbm.xml file was generated
with:
String mappingString =
HbHelper.INSTANCE.generateMapping(ePackages,persistenceOptio ns);
My code for the DataStore-initialization:
final String dataStoreName = "bpel20";
final HbDataStore dataStore = (HbDataStore) HbHelper.INSTANCE
.createRegisterDataStore(dataStoreName);
Properties hibernateProperties = new Properties();
hibernateProperties.setProperty(Environment.DRIVER,
"org.postgresql.Driver");
hibernateProperties.setProperty(Environment.USER, "postgres");
hibernateProperties.setProperty(Environment.URL,
"jdbc:postgresql://127.0.0.1:5432/bpel20");
hibernateProperties.setProperty(Environment.PASS, "XXXXX");
hibernateProperties.setProperty(Environment.DIALECT,
"org.hibernate.dialect.PostgreSQLDialect");
dataStore.setHibernateProperties(hibernateProperties);
Properties persistenceOptions = new Properties();
persistenceOptions.setProperty(PersistenceOptions.INHERITANC E_MAPPING,
"JOINED");
persistenceOptions.setProperty(
PersistenceOptions.FETCH_CONTAINMENT_EAGERLY,true");
persistenceOptions.setProperty(PersistenceOptions.SET_CASCAD E_ALL_ON_CONTAINMENT,
"true");
persistenceOptions.setProperty(PersistenceOptions.USE_MAPPIN G_FILE,
"true");
persistenceOptions.setProperty(PersistenceOptions.PERSISTENC E_XML,
"");
dataStore.setPersistenceProperties(persistenceOptions);
dataStore.initialize();
With kind regards
Daniel Gerlach
|
|
|
Re: Problem using generated hibernate mapping file [message #94661 is a reply to message #94611] |
Tue, 28 August 2007 12:44 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Daniel,
Are you using the latest build (there was a bug a few builds back which caused the issue you are
describing?
You can also check if the hibernate.hbm.xml is really copied to the build/output folder?
gr. Martin
Daniel Gerlach wrote:
> Hello,
>
> i want to use a self-generated mapping file because i have to change it
> a litte.
> My problem is that teneo don't find this file. I activated the
> PersistenceOptions.USE_MAPPING_FILE,"true") and set the Properties in
> the HbDataStore. My hibernate.hbm.xml is in the root of the classpath.
> I also tried it with
> PersistenceOptions.PERSISTENCE_XML,"absolutePath or relativePath ");
> Both doesn't work.
>
> I use teneo 0.8 and eclipse3.3. The hibernate.hbm.xml file was generated
> with:
> String mappingString =
> HbHelper.INSTANCE.generateMapping(ePackages,persistenceOptio ns);
>
> My code for the DataStore-initialization:
>
> final String dataStoreName = "bpel20";
> final HbDataStore dataStore = (HbDataStore) HbHelper.INSTANCE
> .createRegisterDataStore(dataStoreName);
> Properties hibernateProperties = new Properties();
> hibernateProperties.setProperty(Environment.DRIVER,
> "org.postgresql.Driver");
> hibernateProperties.setProperty(Environment.USER, "postgres");
> hibernateProperties.setProperty(Environment.URL,
> "jdbc:postgresql://127.0.0.1:5432/bpel20");
> hibernateProperties.setProperty(Environment.PASS, "XXXXX");
> hibernateProperties.setProperty(Environment.DIALECT,
> "org.hibernate.dialect.PostgreSQLDialect");
> dataStore.setHibernateProperties(hibernateProperties);
> Properties persistenceOptions = new Properties();
>
> persistenceOptions.setProperty(PersistenceOptions.INHERITANC E_MAPPING,
> "JOINED");
> persistenceOptions.setProperty(
> PersistenceOptions.FETCH_CONTAINMENT_EAGERLY,true");
>
> persistenceOptions.setProperty(PersistenceOptions.SET_CASCAD E_ALL_ON_CONTAINMENT,
> "true");
> persistenceOptions.setProperty(PersistenceOptions.USE_MAPPIN G_FILE,
> "true");
> persistenceOptions.setProperty(PersistenceOptions.PERSISTENC E_XML,
> "");
> dataStore.setPersistenceProperties(persistenceOptions);
> dataStore.initialize();
>
> With kind regards
>
> 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: Problem using generated hibernate mapping file [message #609566 is a reply to message #94611] |
Tue, 28 August 2007 12:44 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Daniel,
Are you using the latest build (there was a bug a few builds back which caused the issue you are
describing?
You can also check if the hibernate.hbm.xml is really copied to the build/output folder?
gr. Martin
Daniel Gerlach wrote:
> Hello,
>
> i want to use a self-generated mapping file because i have to change it
> a litte.
> My problem is that teneo don't find this file. I activated the
> PersistenceOptions.USE_MAPPING_FILE,"true") and set the Properties in
> the HbDataStore. My hibernate.hbm.xml is in the root of the classpath.
> I also tried it with
> PersistenceOptions.PERSISTENCE_XML,"absolutePath or relativePath ");
> Both doesn't work.
>
> I use teneo 0.8 and eclipse3.3. The hibernate.hbm.xml file was generated
> with:
> String mappingString =
> HbHelper.INSTANCE.generateMapping(ePackages,persistenceOptio ns);
>
> My code for the DataStore-initialization:
>
> final String dataStoreName = "bpel20";
> final HbDataStore dataStore = (HbDataStore) HbHelper.INSTANCE
> .createRegisterDataStore(dataStoreName);
> Properties hibernateProperties = new Properties();
> hibernateProperties.setProperty(Environment.DRIVER,
> "org.postgresql.Driver");
> hibernateProperties.setProperty(Environment.USER, "postgres");
> hibernateProperties.setProperty(Environment.URL,
> "jdbc:postgresql://127.0.0.1:5432/bpel20");
> hibernateProperties.setProperty(Environment.PASS, "XXXXX");
> hibernateProperties.setProperty(Environment.DIALECT,
> "org.hibernate.dialect.PostgreSQLDialect");
> dataStore.setHibernateProperties(hibernateProperties);
> Properties persistenceOptions = new Properties();
>
> persistenceOptions.setProperty(PersistenceOptions.INHERITANC E_MAPPING,
> "JOINED");
> persistenceOptions.setProperty(
> PersistenceOptions.FETCH_CONTAINMENT_EAGERLY,true");
>
> persistenceOptions.setProperty(PersistenceOptions.SET_CASCAD E_ALL_ON_CONTAINMENT,
> "true");
> persistenceOptions.setProperty(PersistenceOptions.USE_MAPPIN G_FILE,
> "true");
> persistenceOptions.setProperty(PersistenceOptions.PERSISTENC E_XML,
> "");
> dataStore.setPersistenceProperties(persistenceOptions);
> dataStore.initialize();
>
> With kind regards
>
> 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
|
|
| |
Goto Forum:
Current Time: Fri Apr 26 13:59:02 GMT 2024
Powered by FUDForum. Page generated in 0.02676 seconds
|