Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8860215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:13:27+00:00 2026-06-14T15:13:27+00:00

I am current porting some legacy code over to using JPA and have run

  • 0

I am current porting some legacy code over to using JPA and have run into an issue trying to simplify one of the tables into an entity.

I have a table of various readings taken throughout a 24hr period – every half-hour.
It looks like:

Date     |R1|R2|R3...R48

1/1/2012,1,5,1,3,3,4,5,5....etc

I’d like my entity bean to look something like:

@Entity
public class Reading {

    @Id
    String date;

    @??
    int[] values;

    @???
    int sumOfValues
}

Any suggestions how I could approach this? Is it even possible? Also – I only want to read these values, if that make it any easier.
I’m using EclipseLink 2.4 with MongoDB

** UPDATE **

Almost have it – but need to maintain order somehow (I think the fields are mapped out of order) – or pass through a reference to the column name:

@Entity  
@Customizer (RawDataCustomizer.class)  
public class Reading {  
private List<Integer> values...  
public void setValue(Integer value)...  
public static class RawDataCustomizer implements DescriptorCustomizer {  

    @Override  
    public void customize(ClassDescriptor descriptor) throws Exception {  
    //loses ordering?  
    for (int i=1; i<=48; i++)  
    descriptor.addDirectMapping("R"+i, "getValue", "setValue", "r"+i);  

}  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:13:28+00:00Added an answer on June 14, 2026 at 3:13 pm

    Final solution, using @Customizer – not ideal at all – but works well enough for now:

    public static class RawDataMapping extends EISDirectMapping  {
        private final int index;
        public RawDataMapping(int index, String attributeName,String fieldName) {
            super();
            this.index = index;
            setAttributeName(attributeName);
            setFieldName(fieldName);
            setAttributeAccessor(new CustomAccessorAttributeAccessor(this));
        }
        public void set(Object object, Object value)...
        public Object get(Object object)...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am porting over some old F# code from CTP 1.9.6.8 The code uses
in my current code I wait for some event to occur using something like
I am porting some code that is using OpenCV just to fit an ellipse.
current code I've built function to do something over collection of jQuery elements: var
I'm in the process of porting some code from Objective C to C++. I'm
I'm porting some code to Windows and am stumped. There is some code that
I'm porting some Python code that uses raw TCP sockets to ZeroMQ for better
I am porting some Java to C++ and rather naively jumped in to using
I'm porting some code to Haskell that extensively uses the concept of a peeking
I have some pure CSS navigation I'm working on and I'm trying to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.