You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Stephen Cameron <st...@gmail.com> on 2015/11/06 12:55:15 UTC

datanucleus foreign key name

Hi,

Just interested to know if there is any way to stop DataNucleus adding _oid
to the end of all its generated foreign keys, this it with
@PersistenceCapable( identityType = IdentityType.DATASTORE)?

It adds _id_oid to the tail of them all so wondering why?

Thanks

Re: datanucleus foreign key name

Posted by Stephen Cameron <st...@gmail.com>.
Thanks All,

A few things to try iirc :)

On Sat, Nov 7, 2015 at 5:06 AM, Óscar Bou - GOVERTIS <o....@govertis.com>
wrote:

> Hi Jeroen.
>
> Yes, it does. But it's something usual to add that suffix to FK names.
>
> In fact, most reporting tools try to automatically detect them. So I think
> it's a good practice for the DB scheme.
>
> Regards,
>
> Oscar
>
>
> > El 6 nov 2015, a las 17:57, Jeroen van der Wal <je...@stromboli.it>
> escribió:
> >
> > Indeed it omits _OID but still adds _ID [1]
> >
> > [1]
> >
> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/JPAIdentifierFactory.java#L40-L42
> >
> > On 6 November 2015 at 14:42, Óscar Bou - GOVERTIS <o....@govertis.com>
> > wrote:
> >
> >> Hi to all.
> >>
> >> Not sure and cannot test it now, but the "jpa” naming config. didn’t
> >> included those suffixes.
> >>
> >> Try it yourself.
> >>
> >> Regards,
> >>
> >> Oscar
> >>
> >>
> >>
> >>>> El 6 nov 2015, a las 14:35, Jeroen van der Wal <je...@stromboli.it>
> >>> escribió:
> >>>
> >>> You can write your own Datanucleus identifier factory [1]: extend
> >>> DN2IdentifierFactory and overwrite getColumnIdentifierSuffix
> >>>
> >>> [1]
> >>
> http://www.datanucleus.org/documentation/extensions/rdbms_identifier_factory.html
> >>> [2]
> >>
> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DN2IdentifierFactory.java
> >>> [3]
> >>
> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DNIdentifierFactory.java#L621-L649
> >>>
> >>> On 6 November 2015 at 13:32, Dan Haywood <dan@haywood-associates.co.uk
> >
> >>> wrote:
> >>>
> >>>> Don't know why it does it (it is a rather odd name,  I agree) but iirc
> >> you
> >>>> can override it using @Column(name=...)
> >>>>
> >>>> Check out Estatio, we do it there anyway.
> >>>>
> >>>> Cheers, Dan
> >>>> On 6 Nov 2015 11:55 am, "Stephen Cameron" <steve.cameron.62@gmail.com
> >
> >>>> wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> Just interested to know if there is any way to stop DataNucleus
> adding
> >>>> _oid
> >>>>> to the end of all its generated foreign keys, this it with
> >>>>> @PersistenceCapable( identityType = IdentityType.DATASTORE)?
> >>>>>
> >>>>> It adds _id_oid to the tail of them all so wondering why?
> >>>>>
> >>>>> Thanks
> >>
> >>
>

Re: datanucleus foreign key name

Posted by Óscar Bou - GOVERTIS <o....@govertis.com>.
Hi Jeroen.

Yes, it does. But it's something usual to add that suffix to FK names. 

In fact, most reporting tools try to automatically detect them. So I think it's a good practice for the DB scheme.

Regards, 

Oscar


> El 6 nov 2015, a las 17:57, Jeroen van der Wal <je...@stromboli.it> escribió:
> 
> Indeed it omits _OID but still adds _ID [1]
> 
> [1]
> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/JPAIdentifierFactory.java#L40-L42
> 
> On 6 November 2015 at 14:42, Óscar Bou - GOVERTIS <o....@govertis.com>
> wrote:
> 
>> Hi to all.
>> 
>> Not sure and cannot test it now, but the "jpa” naming config. didn’t
>> included those suffixes.
>> 
>> Try it yourself.
>> 
>> Regards,
>> 
>> Oscar
>> 
>> 
>> 
>>>> El 6 nov 2015, a las 14:35, Jeroen van der Wal <je...@stromboli.it>
>>> escribió:
>>> 
>>> You can write your own Datanucleus identifier factory [1]: extend
>>> DN2IdentifierFactory and overwrite getColumnIdentifierSuffix
>>> 
>>> [1]
>> http://www.datanucleus.org/documentation/extensions/rdbms_identifier_factory.html
>>> [2]
>> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DN2IdentifierFactory.java
>>> [3]
>> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DNIdentifierFactory.java#L621-L649
>>> 
>>> On 6 November 2015 at 13:32, Dan Haywood <da...@haywood-associates.co.uk>
>>> wrote:
>>> 
>>>> Don't know why it does it (it is a rather odd name,  I agree) but iirc
>> you
>>>> can override it using @Column(name=...)
>>>> 
>>>> Check out Estatio, we do it there anyway.
>>>> 
>>>> Cheers, Dan
>>>> On 6 Nov 2015 11:55 am, "Stephen Cameron" <st...@gmail.com>
>>>> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> Just interested to know if there is any way to stop DataNucleus adding
>>>> _oid
>>>>> to the end of all its generated foreign keys, this it with
>>>>> @PersistenceCapable( identityType = IdentityType.DATASTORE)?
>>>>> 
>>>>> It adds _id_oid to the tail of them all so wondering why?
>>>>> 
>>>>> Thanks
>> 
>> 

Re: datanucleus foreign key name

Posted by Jeroen van der Wal <je...@stromboli.it>.
Indeed it omits _OID but still adds _ID [1]

[1]
https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/JPAIdentifierFactory.java#L40-L42

On 6 November 2015 at 14:42, Óscar Bou - GOVERTIS <o....@govertis.com>
wrote:

> Hi to all.
>
> Not sure and cannot test it now, but the "jpa” naming config. didn’t
> included those suffixes.
>
> Try it yourself.
>
> Regards,
>
> Oscar
>
>
>
> > El 6 nov 2015, a las 14:35, Jeroen van der Wal <je...@stromboli.it>
> escribió:
> >
> > You can write your own Datanucleus identifier factory [1]: extend
> > DN2IdentifierFactory and overwrite getColumnIdentifierSuffix
> >
> > [1]
> >
> http://www.datanucleus.org/documentation/extensions/rdbms_identifier_factory.html
> > [2]
> >
> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DN2IdentifierFactory.java
> > [3]
> >
> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DNIdentifierFactory.java#L621-L649
> >
> > On 6 November 2015 at 13:32, Dan Haywood <da...@haywood-associates.co.uk>
> > wrote:
> >
> >> Don't know why it does it (it is a rather odd name,  I agree) but iirc
> you
> >> can override it using @Column(name=...)
> >>
> >> Check out Estatio, we do it there anyway.
> >>
> >> Cheers, Dan
> >> On 6 Nov 2015 11:55 am, "Stephen Cameron" <st...@gmail.com>
> >> wrote:
> >>
> >>> Hi,
> >>>
> >>> Just interested to know if there is any way to stop DataNucleus adding
> >> _oid
> >>> to the end of all its generated foreign keys, this it with
> >>> @PersistenceCapable( identityType = IdentityType.DATASTORE)?
> >>>
> >>> It adds _id_oid to the tail of them all so wondering why?
> >>>
> >>> Thanks
> >>>
> >>
>
>

Re: datanucleus foreign key name

Posted by Óscar Bou - GOVERTIS <o....@govertis.com>.
Hi to all.

Not sure and cannot test it now, but the "jpa” naming config. didn’t included those suffixes.

Try it yourself.

Regards,

Oscar



> El 6 nov 2015, a las 14:35, Jeroen van der Wal <je...@stromboli.it> escribió:
> 
> You can write your own Datanucleus identifier factory [1]: extend
> DN2IdentifierFactory and overwrite getColumnIdentifierSuffix
> 
> [1]
> http://www.datanucleus.org/documentation/extensions/rdbms_identifier_factory.html
> [2]
> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DN2IdentifierFactory.java
> [3]
> https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DNIdentifierFactory.java#L621-L649
> 
> On 6 November 2015 at 13:32, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
> 
>> Don't know why it does it (it is a rather odd name,  I agree) but iirc you
>> can override it using @Column(name=...)
>> 
>> Check out Estatio, we do it there anyway.
>> 
>> Cheers, Dan
>> On 6 Nov 2015 11:55 am, "Stephen Cameron" <st...@gmail.com>
>> wrote:
>> 
>>> Hi,
>>> 
>>> Just interested to know if there is any way to stop DataNucleus adding
>> _oid
>>> to the end of all its generated foreign keys, this it with
>>> @PersistenceCapable( identityType = IdentityType.DATASTORE)?
>>> 
>>> It adds _id_oid to the tail of them all so wondering why?
>>> 
>>> Thanks
>>> 
>> 


Re: datanucleus foreign key name

Posted by Jeroen van der Wal <je...@stromboli.it>.
You can write your own Datanucleus identifier factory [1]: extend
DN2IdentifierFactory and overwrite getColumnIdentifierSuffix

[1]
http://www.datanucleus.org/documentation/extensions/rdbms_identifier_factory.html
[2]
https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DN2IdentifierFactory.java
[3]
https://github.com/datanucleus/datanucleus-rdbms/blob/0a769efa72174ee0907f4b9c4d5eb7e5389058d6/src/main/java/org/datanucleus/store/rdbms/identifier/DNIdentifierFactory.java#L621-L649

On 6 November 2015 at 13:32, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> Don't know why it does it (it is a rather odd name,  I agree) but iirc you
> can override it using @Column(name=...)
>
> Check out Estatio, we do it there anyway.
>
> Cheers, Dan
> On 6 Nov 2015 11:55 am, "Stephen Cameron" <st...@gmail.com>
> wrote:
>
> > Hi,
> >
> > Just interested to know if there is any way to stop DataNucleus adding
> _oid
> > to the end of all its generated foreign keys, this it with
> > @PersistenceCapable( identityType = IdentityType.DATASTORE)?
> >
> > It adds _id_oid to the tail of them all so wondering why?
> >
> > Thanks
> >
>

Re: datanucleus foreign key name

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Don't know why it does it (it is a rather odd name,  I agree) but iirc you
can override it using @Column(name=...)

Check out Estatio, we do it there anyway.

Cheers, Dan
On 6 Nov 2015 11:55 am, "Stephen Cameron" <st...@gmail.com>
wrote:

> Hi,
>
> Just interested to know if there is any way to stop DataNucleus adding _oid
> to the end of all its generated foreign keys, this it with
> @PersistenceCapable( identityType = IdentityType.DATASTORE)?
>
> It adds _id_oid to the tail of them all so wondering why?
>
> Thanks
>