About

Jadira is the home for Sousan and Chris Pheby's open source projects. These are reusable open source Java modules that provide first class solutions using the most effective current JEE technologies.

Search
Tag Cloud
...
Login

Jadira Support > Reflection exception with LocalDate

Hi. I'm getting an strange exception when reading entities with Hibernate. Here's the full stack trace: http://pastebin.com/QXTmpyYZ. I'm getting the exception in a simple fetch all query.

My entity code is:


@Entity
public class Evento extends IdManagedBean {

...

@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDate")
private LocalDate fecha;

public LocalDate getFecha() {
return fecha;
}

public void setFecha(LocalDate fecha) {
this.fecha = fecha;
}

...

}


If you need any additional info I'll just give it. Thanks in advance...

March 15, 2012 | Unregistered CommenterAugusto

Forgot to mention: the inverse process (saving entities to DB with joda time fields) is working correctly... (LocalDate field is saved as sql "date" type)

March 15, 2012 | Unregistered CommenterAugusto

Another problem...

I'm getting a ClassCastException:
java.lang.ClassCastException: org.joda.time.LocalDate cannot be cast to org.joda.time.LocalDate

Seems to be related to classloaders...

This is the full stack trace http://pastebin.com/Y8P8k9KC

March 15, 2012 | Unregistered CommenterAugusto

All these problems seem related to Eclipse RCP, because I created a new Java project and had no trouble saving and retrieving entities...

March 15, 2012 | Unregistered CommenterAugusto

Augusto,

Is this issue resolved or are you still getting a problem?

Thanks Chris

March 17, 2012 | Registered CommenterChris

I'm still getting the same problem. I tried creating a new simple RCP app from scratch, and the same error raised. To avoid this problem in my working app, I had to conserve the properties with java.util.Date and duplicate getters/setters to make use of Joda types.

March 21, 2012 | Unregistered CommenterAugusto

My suggestion is that this is some kind of classloading issue related to OSGi. If you can provide me a simple example to reproduce this problem I will take a look and see if I can determine the root cause of your issue. You can send it to the project mailing list or open an issue in the project issue tracker (both are linked from http://usertype.sourceforge.net/).

March 30, 2012 | Registered CommenterChris

I've just created and issue in the sourceforge issue tracking.

Thanks in advance, Augusto

April 4, 2012 | Unregistered CommenterAugusto

Chris, have you taken a look to the example I uploaded? Thanks, Augusto

April 14, 2012 | Unregistered CommenterAugusto