0

I have here a table, where the date is a number. (days since year 0) In the database (oracle) there is a custom function, which converts the number to a date.

Is there an easy way to use that in an jpa Entity?

I just need this for reading. Sure, I could read out the number and convert it myself, but it would be better if i just could use the function.

Something like:

@Entity
public class Person{

@Column(name="toCustomDate(dateAsNumber)")
private Date date;

}

1 Answer 1

2

The best shot would be to look into the @Formula annotation, or simply save that date instead of the number in your database?

Sign up to request clarification or add additional context in comments.

1 Comment

The table is about 15 years old and still in use in many different applications. But the @Formula annotation does it for me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.