util « Data Type « JPA Q&A





1. org.postgresql.util.PGobject cannot be cast to org.postgis.PGgeometry    stackoverflow.com

When I try to load points from a PostGIS database, I get the following exception:

Caused by: java.lang.ClassCastException: org.postgresql.util.PGobject
        at org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:75)
      ...

2. Why can't i compare java.util.Date to mysql dates?    stackoverflow.com

i have a strange situation: I'm using jpa/hibernate to get rows from a mySql DB table where a date column is greater or equal to a date i send in (stripped out ...

3. Hibernate: MySql DATETIME to java.util.Date    coderanch.com

Hello Possibly a quick question. I am mapping a MySql datetime field to a java.util.Date field but only the date part is being set, I lose all time information from the DB. My field is: Name: due Datatype: DATETIME My mapping line is: I have two rows. The due field is set to: 2005-08-02 10:22:00 2005-08-02 10:23:00 ...

4. Trying to get a java.util.Date Object and getting TimeStamp    forum.hibernate.org

Hy, I have a property in a hbm file that is java.util.Date; in the Database Oracle the data type is DATE and the LENGHT is 7. 1. Everytime I recover this property from hibernate, what I recover is a TimeStamp object and not a Date object(normal?) The real problem is when the date in the database has 23 hour like this: ...

5. Comparing java.util.Date s in HQL    forum.hibernate.org

Hi, I have a problem when i try to compare a java.util.Date with a persisted java.util.Date in a postgres database using HQL. Basically when the util.date is stored in the DB it is stored as a timestamp with a timezone. When i compare a date created by a user in my java app with the persisted date in the database i'm ...

6. java.sql.Timestamp intances returned instead of java.util.Da    forum.hibernate.org

Newbie Joined: Mon Feb 09, 2004 6:45 pm Posts: 10 Location: Feltre, BL Italy Hi all. Using the following mapping definition for class Item, it is correclty incarnated when I perform queries using the Criteria interface: the Item.anagModifyDate gets type java.util.Date. Unfortunately, my app often needs to perform queries like: SELECT item.anagModifyDate FROM Item AS item via the Query interface, Query.list() ...

7. No persister for: java.util.HashMap    forum.hibernate.org

Hi, My application is using Spring+Hibernate with Mysql. I'm tesing my dao with dbunit. The test saving the domain object (contening a map) fail because of the thrown exception : org.springframework.orm.hibernate.HibernateSystemException: No persister for: java.util.HashMap; nested exception is net.sf.hibernate.MappingException: No persister for: java.util.HashMap net.sf.hibernate.MappingException: No persister for: java.util.HashMap at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344) The Test loading the domain object succed. What's wrong ? Don't ...

8. Can't get a java.util.Date back    forum.hibernate.org

Using hibernate 2.1 attached to PostgreSQL 7.4.5, I'm havig trouble getting the current time back from the database using hibernate. My code: public static java.util.Date getDbCurrentTime() throws HibernateException { Query query = session.createSQLQuery("select CURRENT_TIMESTAMP", "date", java.util.Date.class); java.util.Date dbTime = (java.util.Date)query.uniqueResult(); log.debug("getDbCurrentTime(): " + dbTime); return dbTime; } When I run this, it fails with an exception net.sf.hibernate.MappingException: No persister for: java.util.Date ...

9. java.util.Date property is populated with java.sql.Timestamp    forum.hibernate.org

Hibernate version: 2.1.6 on JDK 1.5 Mapping documents: Code:





10. java.sql.Date X java.util.Date in value objects    forum.hibernate.org

Value object: ... public class Xxx{ public java.sql.Date data; public Xxx(java.sql.Date data){ this.data = data; } } ... HQL: ... select new Xxx(sc.data) from SomeClass sc ... Exception: 1 errors occurred while listing (and calling getPathNames). net.sf.hibernate.PropertyNotFoundException: no appropriate constructor in class: Xxx I'm sure sc.data is a java.sql.Date in the java code and in the mapping files (type=java.sql.Date)... the sql-type ...

11. java.util.Date and java.sql.Date    forum.hibernate.org

Hibernate maps java.util.Date to java.sql.Date when serializing to DB, and returns java.sql.Date when deserializing. So you can get some class cast errors on compareTo if you are using JDK1.5. I have copied DateType and TimestampType classes and modified them to return java.util.Date in get method. Then I've placed them into separate jar and then I've tried to include this jar in ...

12. Oracle 9i, Hibernate 2, java.util.Date problems    forum.hibernate.org

Select by Criteria on Date field doesn't work anymore. My test case is : - Select an existing Evenement Object by Date Field And Id Code:

13. MySql DATETIME doesn't populate time in java.util.Date    forum.hibernate.org

Hello Possibly a quick question. I am mapping a MySql datetime field to a java.util.Date field but only the date part is being set, I lose all time information from the DB. My field is: Name: due Datatype: DATETIME My mapping line is: I have two rows. The due field is set to: 2005-08-02 10:22:00 2005-08-02 10:23:00 ...

14. java.util.Date losing milliseconds    forum.hibernate.org

I am using Hibernate 3. I have a column which is a java.util.Date and I have specified its type as Timestamp in the mapping file. There are 2 things I do not understand: 1. Generated database column When I generate the database table, it creates a mysql column of type datetime not timestamp. The hibernal sql dialect ...

15. Julian Date to java.util.Date    forum.hibernate.org

Not sure, but think about it in terms of JDBC and your database. if you created a java-jdbc test routine that opened up a ResultSet and you called rs.getDate("JDT"); and you JDT col was a number would it convert to java.sql.Date? so, I think Julian date is milliseconds since January 1, 1970, 00:00:00 GMT ..right? if so, then it should work ...

16. Date & Timestamp: how to get Hib. to give a java.util.Da    forum.hibernate.org

hi, thanks for your answers. Tim, I've tried the mapping with type="date" and type="imm_date", but I always get a java.sql.Timestamp. I've checked a lot of other mappings, all my dates are mapped with java.util.Date and all result in having a java.sql.Timestamp. Not specifying the type makes Hibernate have a guess on the type you want to use based on the porperty ...





17. java.util.Date and java.sql.Date    forum.hibernate.org

Hi, I read several posts stating that it's normal to see how hibernate maps a DATE in the database to a java.sql.Date and then assigns it to a java.util.Date property in your domain object. As you know, there are some issues in the implementation of the method .equals in both classes: java.util.Date.equals(java.sql.Date) but the opposite isn't true due to the nanoseconds ...

18. java.util.ArrayList cannot be cast to java.util.Set    forum.hibernate.org

Author Message mangelo Post subject: java.util.ArrayList cannot be cast to java.util.Set Posted: Mon Sep 10, 2007 7:37 pm Beginner Joined: Thu Aug 17, 2006 12:44 pm Posts: 22 Location: Ohio This has to be the strangest bug I've ever seen. I have taken over this project from another developer who was not using Hibernate. The misspellings are not mine. ...

19. Java.util.date and Hibernate Date    forum.hibernate.org

21. Accessing java.util.HashMap    forum.hibernate.org

Newbie Joined: Mon Feb 18, 2008 5:45 am Posts: 5 Hibernate version: 3.2.5-ga Name and version of the database you are using: MySql 5.0.45 I'm using the following model: Code: package com.dummy.model; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.Table; import org.hibernate.annotations.CollectionOfElements; import ...