Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink Struct fields order(EclipseLink Oracle Object -> @Struct field order in Java class)
Eclipselink Struct fields order [message #1724850] Fri, 26 February 2016 14:28
Srikanth Narisetty is currently offline Srikanth NarisettyFriend
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;

}
Previous Topic:JPQL with a join fetch on a entity with a lazy fetch attribute.
Next Topic:NullPointerException failed to process remote command
Goto Forum:
  


Current Time: Thu Apr 25 08:57:00 GMT 2024

Powered by FUDForum. Page generated in 0.02697 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top