tags:

views:

581

answers:

1

I have the following field definitions in one of my JPA entities:

@Column(nullable = false, name = "start_time",
columnDefinition= "TIMESTAMP WITH TIME ZONE")
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Date startTime = new Date();

@Column(nullable = true, name = "end_time",
columnDefinition= "TIMESTAMP WITH TIME ZONE")
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Date endTime = null;

The database is PostgreSQL and using timestamp without timezone is not an option. The inserts and updates are going fine regarding the timezone. A problem arises (at least I think so) when I try to run a SELECT JPQL query on some test data and the filter parameters are Date objects. The query OpenJPA generates doesn't include the timezone in the parameters. Can anyone give me some guidance regarding JPA and timestamp with timezone columns?

A: 

You could have a look on java.util.Calendar.

CalendarGuy