-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Temporal annotation from attributes to avoid EclipseLink error #420
Conversation
import java.sql.Time; | ||
import java.sql.Timestamp; | ||
|
||
public class TemporalDates { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you port over the following fields:
- TemporalType.TIMESTAMP used with
java.sql.Date
- TemporalType.DATE used with
java.sql.Timestamp
- TemporalType.TIME used with
java.sql.Timestamp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did notice the rule is overly broad, but the other cases that we remove the annotation would have been an invalid combination in either OpenJPA or EclipseLink anyway. So it would just fix the code error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity, the current implementation handles/fixes all the cases except the ones that require a converter.
Do we want to include the converter in this recipe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not worry about the converter for now. But I'll create an issue to look into it later.
) | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably makes sense to have a test that uses Date, Time, and Timestamp classes from other packages such as java.util.Date
, java.security.Timestamp
, org.omg.Security.Time
to make it clear those are valid cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the Eclipse page, I only see that java.util.Date
and java.util.Calendar
are allowed. I added a test case with these to show no change occurs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the idea behind the tests using Date, Time, and Timestamp classes from other packages was to make it clear the recipe should only apply to java.sql.Date
, java.sql.Timestamp
, java.sql.Time
. I see I had a typo in my original comment.
Update:
It looks like your allowTemporalOnValidClasses
test covers this
What's changed?
OpenJPA -> EclipseLink recipe to remove
@Temporal
annotation on attributes where data does not need to be converted.What's your motivation?
https://wiki.eclipse.org/EclipseLink/Examples/JPA/Migration/OpenJPA/Mappings#.40Temporal_on_java.sql.Date.2FTime.2FTimestamp_fields
Checklist