Re: Sequence Id in entity

2017-04-17 Thread Jacques Le Roux

Hi Ahmad,

Please use rather user ML for such questions, see why here 
http://ofbiz.apache.org/mailing-lists.html
You will get a better support and it's more fair to share with everybody

The wider the audience the better the answers you might get

Thanks

Jacques


Le 16/04/2017 à 09:31, Ahmad Rabab’ah a écrit :

Hello Dears ,

I have created new entitiy in CompnentName_entitymodel.xml
and I define all filed, but I want to set the “id” as a primary key and 
sequence .
how can I do that .?

Thank you .







Re: Sequence Id in entity

2017-04-16 Thread Aditya Sharma
Hello Ahmad,

You can set primary key for a entity with *prim-key *element.



For a particular *field* you can provide its *type*.



You can refer to field types from *fieldtype*.xml* files where * will be
the name of the database used. For example for Mysql there will be a file
fieldtypemysql.xml.

For *identifier* type, underlying data-structure is *String* data type for
Java and *varchar* for database (You can refer fieldtype*.xml file). So
next sequence need to be generated during create operation. When using
*entity-auto* type services it is *handled internally* but if you are
creating *custom* service for create operation you need to *generate* that.

To generate the next sequence id in create service, getNextSeqId("Entity
Name") method of GenericDelegator is used.
For example:

partyId = delegator.getNextSeqId("Party")

It will generate the next sequence for the Party entity.

Thanks & Regards,
Aditya Sharma
Enterprise Software Engineer
HotWax Systems Pvt. Ltd.
http://www.hotwaxsystems.com/

On Sun, Apr 16, 2017 at 1:01 PM, Ahmad Rabab’ah  wrote:

> Hello Dears ,
>
> I have created new entitiy in CompnentName_entitymodel.xml
> and I define all filed, but I want to set the “id” as a primary key and
> sequence .
> how can I do that .?
>
> Thank you .
>
>
>


Sequence Id in entity

2017-04-16 Thread Ahmad Rabab’ah
Hello Dears ,

I have created new entitiy in CompnentName_entitymodel.xml
and I define all filed, but I want to set the “id” as a primary key and 
sequence .
how can I do that .?

Thank you .