I have a query which works fine when I use NativeQuery but I need to use an EJB query for my problem. Can anyone help me reformat my query so it would work for EJB also?
Here is the Native version
Query query = getEntityManager.createNativeQuery("WITH src as ("
+ "Select distinct TRUNC(CreationDate) a"
+ "From myTable)"
+ "Select src.a from src Order by src.a desc");
The Class for myTable is an Entity type. The Properties are as followed
@Id
private Long Id;
@Column(nullable = false)
private String Name;
@Column(length = 30, nullable = false)
private Timestamp CreationDate;
The properties are as above with setters and getters for them. (Except for ID) Thanks