Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » HBM file generation by teneo
|
Re: HBM file generation by teneo [message #104294 is a reply to message #104268] |
Wed, 05 December 2007 18:13 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Justin,
Is your ecore file in the same project as the generated model sources?
You can also programmatically generate the hbm file through the HbHelper.generateMapping method.
Note that to persist your objects you don't need to generate the hbm file separately, Teneo will do
that for you when you initialize the datastore (as you describe below). You can view the in-memory
hbm by calling the dataStore.getMappingXML method.
gr. Martin
Justin wrote:
> Hi ,
>
> Iam using teneo 0.7.5 with EMF 2.2.
> I have library ecore file.
> Elver Doc says that we can generate hbm file by right-clicking ecore file.
> I have teneo.hibernate and all the hibernate libraries in dependancy
> tab of plugin.xml.
> When i try generating hbm file from ecore file,i get blank hbm file.
>
> The doc says to register datasource the foll way:
> final String dataStoreName = "LibraryDataStore";
> final HbDataStore dataStore =
> HbHelper.INSTANCE.createRegisterDataStore(dataStoreName);
>
> // To configure Hibernate, supply properties describing the JDBC
> driver,
> // URL, username/password and SQL dialect.
> // By default the properties are obtained from the file
> // "hibernate.properties" at the classpath root.
> // Configure the EPackages persisted by this DataStore.
> dataStore.setEPackages(new EPackage[] {EcorePackage.eINSTANCE,
> XMLTypePackage.eINSTANCE});
>
> dataStore.initialize();
>
> Should i run the above piece of code and then right-click to generate
> hbm file.
> Kindly let me know the sequence of steps for hbm file generation from
> ecore at the earliest possible.
> Thanks,
> Justin.
>
>
--
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: HBM file generation by teneo [message #105443 is a reply to message #105393] |
Thu, 27 December 2007 14:29 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Justin,
These columns are created if there is no explicit id and version attribute identified in the model.
A number of things which you can try:
You can control the name of the automatically created id and version control columns through the
PersistenceOptions.VERSION_COLUMN_NAME and PersistenceOptions.ID_COLUMN_NAME options.
If you have explicit eattributes for id and version in the model then you can tag these using the
@Id and @Version annotation. Teneo will then not create e_id or e_version columns.
You can disable the automatic creation of the version column by setting the option:
PersistenceOptions.ALWAYS_VERSION to "false".
gr. Martin
Justin wrote:
> Hi Martin,
> When domain model class is persisted through Teneo 0.75,it creates
> E_ID,E_Version columns to the new table created for entity domain class.
> If this is not needed if customer didn't want it,is there a way to
> bypass these extra column creations.Teneo is not being accepted sue to
> this in my project.Pls let me know asap.
> Thanks,
> Justin.
>
--
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: HBM file generation by teneo [message #105528 is a reply to message #105521] |
Mon, 31 December 2007 12:39 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Justin,
To set options you have to generate the hbm programmatically. This is not very difficult. Just
create a class (in your model project) with a main static method and from there call
HbHelper.generateMapping. This method returns a string with the hbm. The method expects two
parameters, one the set of epackages, the other a properties object. To disable versioning set this
in the properties object (props) you pass to the method:
props.setProperty(PersistenceOptions.ALWAYS_VERSION, "false");
gr. Martin
justin wrote:
> Hi Martin ,
> Thanks for your reply.
> The mail says:
> You can disable the automatic creation of the version column by setting
> the option: PersistenceOptions.ALWAYS_VERSION to "false".
> WHere Do I need to set this option .Is it In code or genmodel editor.
> It doesn't seem to be there in genmodel editor.
> If it is in code,it didn't allow as PersistenceOptions.ALWAYS_VERSION is
> final variable when it is called in standalone class.
> Pls let me know asap.
> Regards,
> Justin
>
--
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: HBM file generation by teneo [message #612755 is a reply to message #104268] |
Wed, 05 December 2007 18:13 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Justin,
Is your ecore file in the same project as the generated model sources?
You can also programmatically generate the hbm file through the HbHelper.generateMapping method.
Note that to persist your objects you don't need to generate the hbm file separately, Teneo will do
that for you when you initialize the datastore (as you describe below). You can view the in-memory
hbm by calling the dataStore.getMappingXML method.
gr. Martin
Justin wrote:
> Hi ,
>
> Iam using teneo 0.7.5 with EMF 2.2.
> I have library ecore file.
> Elver Doc says that we can generate hbm file by right-clicking ecore file.
> I have teneo.hibernate and all the hibernate libraries in dependancy
> tab of plugin.xml.
> When i try generating hbm file from ecore file,i get blank hbm file.
>
> The doc says to register datasource the foll way:
> final String dataStoreName = "LibraryDataStore";
> final HbDataStore dataStore =
> HbHelper.INSTANCE.createRegisterDataStore(dataStoreName);
>
> // To configure Hibernate, supply properties describing the JDBC
> driver,
> // URL, username/password and SQL dialect.
> // By default the properties are obtained from the file
> // "hibernate.properties" at the classpath root.
> // Configure the EPackages persisted by this DataStore.
> dataStore.setEPackages(new EPackage[] {EcorePackage.eINSTANCE,
> XMLTypePackage.eINSTANCE});
>
> dataStore.initialize();
>
> Should i run the above piece of code and then right-click to generate
> hbm file.
> Kindly let me know the sequence of steps for hbm file generation from
> ecore at the earliest possible.
> Thanks,
> Justin.
>
>
--
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: HBM file generation by teneo [message #613037 is a reply to message #105393] |
Thu, 27 December 2007 14:29 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Justin,
These columns are created if there is no explicit id and version attribute identified in the model.
A number of things which you can try:
You can control the name of the automatically created id and version control columns through the
PersistenceOptions.VERSION_COLUMN_NAME and PersistenceOptions.ID_COLUMN_NAME options.
If you have explicit eattributes for id and version in the model then you can tag these using the
@Id and @Version annotation. Teneo will then not create e_id or e_version columns.
You can disable the automatic creation of the version column by setting the option:
PersistenceOptions.ALWAYS_VERSION to "false".
gr. Martin
Justin wrote:
> Hi Martin,
> When domain model class is persisted through Teneo 0.75,it creates
> E_ID,E_Version columns to the new table created for entity domain class.
> If this is not needed if customer didn't want it,is there a way to
> bypass these extra column creations.Teneo is not being accepted sue to
> this in my project.Pls let me know asap.
> Thanks,
> Justin.
>
--
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: HBM file generation by teneo [message #613049 is a reply to message #105521] |
Mon, 31 December 2007 12:39 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Justin,
To set options you have to generate the hbm programmatically. This is not very difficult. Just
create a class (in your model project) with a main static method and from there call
HbHelper.generateMapping. This method returns a string with the hbm. The method expects two
parameters, one the set of epackages, the other a properties object. To disable versioning set this
in the properties object (props) you pass to the method:
props.setProperty(PersistenceOptions.ALWAYS_VERSION, "false");
gr. Martin
justin wrote:
> Hi Martin ,
> Thanks for your reply.
> The mail says:
> You can disable the automatic creation of the version column by setting
> the option: PersistenceOptions.ALWAYS_VERSION to "false".
> WHere Do I need to set this option .Is it In code or genmodel editor.
> It doesn't seem to be there in genmodel editor.
> If it is in code,it didn't allow as PersistenceOptions.ALWAYS_VERSION is
> final variable when it is called in standalone class.
> Pls let me know asap.
> Regards,
> Justin
>
--
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 Sep 20 15:08:25 GMT 2024
Powered by FUDForum. Page generated in 0.04421 seconds
|