I'm trying to generate entities from an existing database.
For this table :
CREATE TABLE `abocc` (
| `ct` int(11) NOT NULL default '0',
| `dt_creat` datetime default NULL,
| `dt_modif` datetime default NULL,
| `dp_use` char(1) NOT NULL default 'O',
| `ct_pers` int(11) NOT NULL default '0',
| `ty` char(4) NOT NULL default '',
| `lb` char(39) default NULL,
| `ct_ref` int(11) default NULL,
| `dt_bgn` datetime default NULL,
| `dt_end` datetime default NULL,
| `dt_bgn_test` datetime default NULL,
| `dt_end_test` datetime default NULL,
| `nb_div` smallint(6) default '12',
| `nb_ren` smallint(6) default '12',
| `nb_ofs` smallint(6) default '0',
| `dp_rglt_post` char(1) default 'N',
| `mt_ht` float(7,2) default NULL,
| `tx_tva` float(6,1) default '19.6',
| PRIMARY KEY (`ct`),
| UNIQUE KEY `ct_pers` (`ct_pers`,`ty`,`ct`),
| UNIQUE KEY `ty` (`ty`,`ct_pers`,`ct`),
| UNIQUE KEY `dp_use` (`dp_use`,`ct`)
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
I get an error when trying to compile generated java files :
[javac] Compiling 69 source files to
/home/gaboo/workspace/testSeamLrb/exploded-archives/testSeamLrb.jar
| [javac] /home/gaboo/workspace/testSeamLrb/src/com/lrb/testSeamLrb/Abocc.java:20:
'}' expected
| [javac] , uniqueConstraints = {
@UniqueConstraint(columnNames={"ct_pers", "ty", "ct"})
@UniqueConstraint(columnNames={"dp_use", "ct"}) }
| [javac]
^
|
Here is the generated annotation :
/**
| * Abocc generated by hbm2java
| */
| @Entity
| @Table(name="abocc"
| ,catalog="lrb"
| , uniqueConstraints = { @UniqueConstraint(columnNames={"ct_pers",
"ty", "ct"}) @UniqueConstraint(columnNames={"dp_use",
"ct"}) }
| )
| public class Abocc implements java.io.Serializable {
|
|
There is indeed several unique keys constraints. Obviously, the annotation syntax is not
correct. I've not found an example annotation with two unique constraints either on
hibernate documentatin or searching on google.
I though it is a hibernate problem but the hibernate site asks us to come here if it's
seam related.
Thanks for your help.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991701#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...