Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Foreign key as String

Hello Thierry,

This might seem like a silly question, but is getIdLog also annotated with @Id? The fk field "ID_LOG" will reference the field marked as the ID in the X class, which will be a string if it references a string etc. If its not the case, please post the two classes involved.

Best Regards,
Chris

On 16/08/2010 3:30 AM, Thierry Peng wrote:
Hi

Is there a way to use a String (varchar column) as a foreign key for a mantytoone relation in eclipselink? I'm running always in a

java.lang.NumberFormatException: For input string: "1-1-1"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:456)
    at java.lang.Integer.<init>(Integer.java:620)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToInteger(ConversionManager.java:521) at org.eclipse.persistence.internal.helper.ConversionManager.convertObject(ConversionManager.java:113)

with the following annotations:

@ManyToOne(fetch = FetchType.LAZY)
 @JoinColumn(name = "ID_LOG", nullable = false)
 public X getX()

and

@Column(name = "ID_LOG", unique = true, nullable = false, length = 10)
 public String getIdLog()

greetings

thierry
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top