ClassCastException in AbstractQuerydslProcessor.class #471

Closed
gorder opened this Issue Aug 7, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@gorder

gorder commented Aug 7, 2013

Apparently this line is causing me issues:

TypeMirror superTypeMirror = ((TypeElement)element).getSuperclass();

The problem is I use Spring and they have a setPackagesToScan option so that you do not need to use a persistence.xml. The problem with that is if I want to define custom user types to all entities it will not pick them up without a persistence annotation. Therefore I have a package-info.java that looks like below so that I don't need to add types to all of my @Entities on Joda classes. The apt-maven plugin is picking this up and attempting to cast it. There is a property on Element that can be checked to see if it is package before performing the cast.

@MappedSuperclass
@TypeDefs({
    @TypeDef(name = "dateTime", typeClass = org.jadira.usertype.dateandtime.joda.PersistentDateTime.class, defaultForType = org.joda.time.DateTime.class, parameters = {
        @Parameter(value = "jvm", name = "databaseZone"),
        @Parameter(value = "jvm", name = "javaZone")}),
    @TypeDef(name = "localDate", typeClass = org.jadira.usertype.dateandtime.joda.PersistentLocalDate.class, defaultForType = org.joda.time.LocalDate.class, parameters = {
        @Parameter(value = "jvm", name = "databaseZone"),
        @Parameter(value = "jvm", name = "javaZone")})})
package com.xxx.xxx.model.entity;

import javax.persistence.MappedSuperclass;

import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;

timowest added a commit that referenced this issue Aug 7, 2013

timowest added a commit that referenced this issue Aug 7, 2013

@gorder

This comment has been minimized.

Show comment
Hide comment
@gorder

gorder Aug 8, 2013

Thanks!

I figured you would have just checked element.getKind() == ElementKind.PACKAGE but what you did is safer anyway :)

gorder commented Aug 8, 2013

Thanks!

I figured you would have just checked element.getKind() == ElementKind.PACKAGE but what you did is safer anyway :)

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Aug 27, 2013

Member

Released in 3.2.3

Member

timowest commented Aug 27, 2013

Released in 3.2.3

@timowest timowest closed this Aug 27, 2013

@timowest timowest added this to the 3.2.3 milestone Apr 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment