hibernate - Eclipselink gives validation exception -

i used mysqlworkbench modelling tool create db. generated simple testdb testing jpa/eclipselink, netbeans entity , web services generator. when generate entities , services got error message this:
exception description: [class com.rako.rma.rma] uses non-entity [class com.rako.rma.product] target entity in relationship attribute [field productserialnumberlotn]. @ org.eclipse.persistence.exceptions.validationexception.nonentitytargetinrelationship(validationexception.java:1378) rma entity
public class rma implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.identity) @basic(optional = false) @column(name = "rma_id") private integer rmaid; @size(max = 45) @column(name = "temp1") private string temp1; @joincolumn(name = "product_serialnumber_lotn", referencedcolumnname = "serialnumber_lotn") @manytoone(optional = false) private product productserialnumberlotn; product entity
public class product implements serializable { private static final long serialversionuid = 1l; @id @basic(optional = false) @notnull @size(min = 1, max = 20) @column(name = "serialnumber_lotn") private string serialnumberlotn; @size(max = 45) @column(name = "temp1") private string temp1; @size(max = 45) @column(name = "temp2") private string temp2; @joincolumn(name = "serialnumber_lotn", referencedcolumnname = "lotn", insertable = false, updatable = false) @onetoone(optional = false) private serialnumber serialnumber; @onetomany(cascade = cascadetype.all, mappedby = "productserialnumberlotn") private collection<rma> rmacollection; serialnumber entity
public class serialnumber implements serializable { private static final long serialversionuid = 1l; @id @basic(optional = false) @notnull @size(min = 1, max = 20) @column(name = "lotn") private string lotn; @size(max = 45) @column(name = "temp") private string temp; @onetoone(cascade = cascadetype.all, mappedby = "serialnumber") private product product; question
1) did design db incorrectly?
2) netbeans jpa generator working properly?
3) if it's not working 100 %, how can fix jpa notation relations working?
each of entities classes need @entity annotation on top of them:
@entity public class product implements serializable { ...
Comments
Post a Comment