Eclipselink Struct fields order [message #1724850] |
Fri, 26 February 2016 14:28 |
Srikanth Narisetty Messages: 6 Registered: February 2016 |
Junior Member |
|
|
I am working on a EclipseLink application, which uses Oracle Objects as IN and OUT parameters (while invoking stored procedure). As you know we have @Struct annotations available in Eclipselink for representing Oracle Object, I used it and it is working perfectly. But, looks like order of the fields declared in Struct annotated class matters a lot to map to correct field in oracle object. This causes maintenance issues and very difficult to code when object's properties are more. Is there a way in Eclipselink to say map Structure fields based on name and not with order.
Ex: Below is my Struct class. If by chance I declare variables in different order from fields list, wrong/incorrect mappings will happen while fetching records from stored proc. Its always mapping values to fields from top to bottom. @Column name annotation is not able to solve this issue.
@Struct(name = "REC_OBJECT",
fields = {"TRANS_ID", "PROJECT_ID", "LANGUAGE_CODE", "DESCRIPTION"})
@Embeddable
public class Master {
@JsonIgnore
@Column(name = "TRANS_ID")
private String transactionId;
@Column(name = "PROJECT_ID")
private String projectId;
@Column(name = "LANGUAGE_CODE")
private String languageCode;
@Column(name = "DESCRIPTION")
private String description;
}
|
|
|
Powered by
FUDForum. Page generated in 0.02697 seconds