Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException in AbstractQuerydslProcessor.class #471

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

ClassCastException in AbstractQuerydslProcessor.class #471

gorder opened this issue Aug 7, 2013 · 2 comments
Milestone

Comments

@gorder
Copy link

@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
Copy link
Author

@gorder 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
Copy link
Member

@timowest 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants