db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <michael.bousc...@akquinet.de>
Subject Re: How to annotate a column to represent "int unsigned" datatype ?
Date Sun, 01 Jul 2012 12:04:22 GMT

I'm not sure whether I understand he issue correctly. What I understood 
is that you want Datanucleus to create the table for your class Test. 
But the generated table does not have the correct column type for the 
foreign key, since it is not unsigned.

The @Column annotation has an attribute called sqlType that allows you 
to declare the type of the column in the database (in your case "INT(11) 
UNSIGNED"). I'm note sure whether you can have both jdbcType and 
sqlType. I would skip the jdbcType and length when specifying sqlType.

Hope this helps.

Regards Michael

> Hi everyone,
> Here is a sample of my mapping:[code]@PersistenceCapable(identityType =
> IdentityType.APPLICATION, detachable = "true")
> public class Test {
>      @PrimaryKey
>      @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>      private long id;
>      @Persistent(column = "user")
>      @Column(defaultValue = "1", jdbcType = "INTEGER", length =
> 11,allowsNull = "false")
>      private Member member;
>      //Getters and setters
> }[/code]I'm using MySQL.
> I have my object (Test) with a field that maps another object (Member) that
> I'm not allowed to alter it's table. Member's id column type "INT(11)
> Datanucleus (A JDO implementation) is unable to create the "Test" table
> because it's "user" column will have to have a foreign-key constraint to
> point at "Member"'s PK column which is "INT(11)  UNSIGNED". I managed to
> specify it's type and length but I can't specify that it's [b]UNSIGNED[/b] !
> I suppose this can be done using extensions but I can't find a clear and
> detailed specification for the available extensions.
> I reached that page, looked through some of the api docs but found nothing.
> I generally find the extensions annotation very critical sometimes but I
> can't find where is it's specification ?!
> I feel terribly lost right now !

*Michael Bouschen*

akquinet tech@spree GmbH
Bülowstr. 66, D-10783 Berlin

Fon:   +49 30 235 520-33
Fax:   +49 30 217 520-12
Email: michael.bouschen@akquinet.de
Web: www.akquinet.de <http://www.akquinet.de>

akquinet tech@spree GmbH, Berlin
Geschäftsführung: Martin Weber, Dr. Torsten Fink
Amtsgericht Berlin-Charlottenburg HRB 86780 B
USt.-Id. Nr.: DE 225 964 680

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message