JPA2 and UNIQUE Colums

17 views
Skip to first unread message

Arthur Black

unread,
Apr 25, 2017, 7:36:49 AM4/25/17
to minuteproject
Hi, minuteproject does not export unique parameter from the DB. I search for a fix for this problem.

For example we have a User Table with useremail. The email is not a primarykey, not nullable and it is unique.

The generated entite looks like this:

//MP-MANAGED-ADDED-AREA-BEGINNING @UserEmail-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @UserEmail-field-annotation@
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-UserEmail@
    @Column(name="UserEmail"  , length=255 , nullable=false , unique=false)
    private String useremail; 

Any solution for this problem ?

Florian Adler

unread,
May 10, 2017, 8:50:39 AM5/10/17
to minute...@googlegroups.com
Hello Arthur,

Sorry to answer lately,

On which database is it? and is useremail unique as a column? (not a composite unique key?)

Best regards,

Florian.



--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "minuteproject".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse minuteproject+unsubscribe@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Arthur Black

unread,
May 11, 2017, 4:39:26 AM5/11/17
to minuteproject
We tested it on MySql 5.6.34 and  MariaDB  10.0.29. with the same result.

This is the user table : 

--
-- Tabellenstruktur für Tabelle `user`
--

CREATE TABLE IF NOT EXISTS `user` (
  `UserID` int(11) NOT NULL,
  `Passwordresettoken` varchar(255) DEFAULT NULL,
  `UserAvatarimage` varchar(255) DEFAULT NULL,
  `UserCity` varchar(75) DEFAULT NULL,
  `UserCountry` varchar(5) DEFAULT NULL,
  `UserEmail` varchar(255) NOT NULL,
  `UserFirstname` varchar(255) DEFAULT NULL,
  `UserLocale` varchar(5) DEFAULT NULL,
  `UserPassword` varchar(255) DEFAULT NULL,
  `UserPreferences` longtext,
  `UserStatus` varchar(255) DEFAULT NULL,
  `UserStreet` varchar(255) DEFAULT NULL,
  `UserSurname` varchar(255) DEFAULT NULL,
  `UserType` varchar(8) DEFAULT NULL,
  `UserZip` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Indizes der exportierten Tabellen
--

--
-- Indizes für die Tabelle `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`UserID`),
  ADD UNIQUE KEY `UserEmail` (`UserEmail`);

and  this comes out with the JPA2
 
Reply all
Reply to author
Forward
0 new messages