Need help regarded emf generated model [message #421276] |
Sat, 02 August 2008 15:31 |
Eclipse User |
|
|
|
Originally posted by: kalkar.prashant.gmail.com
Hi,
I am working on an project which use xsd schema, and generate the model
code with emf, teneo and hibernate plugins.
The generated code allows to access the fields in the db tables. But no
methods are generated to access the primary key (e_id column) of the table.
Since ability to assess primary key to identify unique record in table
is basic, that should be present in the generated code.
Am I missing any basic concept here? Is there any other way to access
the primary key.
Please help.
Regards,
Prashant
|
|
|
|
|
|
Re: Need help regarded emf generated model [message #421307 is a reply to message #421306] |
Sun, 03 August 2008 18:17 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Prashant,
Teneo does not generate the java code for you. The implicit id's (and version) columns are added
automatically for convenience reasons for tutorials. For production applications I would not advice
to use it.
So you should explicitly define your id features/elements in the schema. An id feature should be
annotated with @Id (and @GeneratedValue if you want it to be set by the db). You can also define a
simple type in xsd and annotated the simpletype with @Id then you don't need to annotate each Id
feature.
The same applies to the version column.
Hope this helps.
gr. Martin
Ed Merks wrote:
> Prashant,
>
> It's definitely a Teneo question. Hopefully Martin will notice it.
>
>
> Prashant wrote:
>> Hi,
>>
>> Let me put the problem again.
>>
>> The application model code is generated using EMF from XML schema, and
>> also teneo plugin is used for hibernate mapping.
>>
>> The application creates the database for the first run, and each table
>> generated is assigned e_id as the primary key.
>>
>> Since the e_id column (which is the table primary key) is generated,
>> the corresponding getter setter methods are not present for this
>> column in the module code.
>> All I want to know is there any way I can access the primary key using
>> EObject object for a given table.
>>
>> Regards,
>> Prashant
>>
>>
>>
--
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03631 seconds