Hi, I need to work with Timestamp diff in two entity fields, but this queries
SELECT count(p) FROM Player p WHERE p.loginAt.getTime()-p.registeredAt.getTime()>:value
SELECT p.loginAt.getTime() FROM Player p
fails with
object is not an instance of declaring class
or
java.lang.ClassCastException
but
SELECT p.loginAt.getYear() FROM Player p
works. How that possible?
@Entity public class Player { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public int id; @Temporal(TemporalType.TIMESTAMP) public Timestamp loginAt; @Temporal(TemporalType.TIMESTAMP) public Timestamp registeredAt = AppCore.getTime(); ... }
Is there some other way to compare two Timestamps within ObjectDB not to transfering them to Java? Because there about 10^6 records.