Trying to create a simple example from the bottom up, however
I could not reproduce that either. However, removing all properties of the
entities and adding them step by step up again, I'm now getting
trouble to generate the sources again (same stacktrace as before)
@Entity(value = "PERSON", noClassnameStored = true)
public class Person implements
org.apache.shindig.social.opensocial.model.Person {
private static final long serialVersionUID = 1L;
@Id
private ObjectId objectId = null;
private String id;
....
// the next two methods are causing the trouble
@Override
public Map<String, ?> getAppData() {
return personAppData;
}
@Override
public void setAppData(Map<String, ?> appData) {
Map<String, String> m = new HashMap<String, String>();
for (Iterator<String> iterator =
appData.keySet().iterator(); iterator
.hasNext();) {
String k = iterator.next();
String v = (String) appData.get(k);
m.put(k, v);
}
personAppData = m;
}
Once these 2 methods are removed at least the source generation runs
through, however there is now
A Qstring class generated with compiler errors:
public class QString extends BeanPath {
...
public QString(BeanPath<String> entity) { super(entity.getMetadata());
}
public QString(PathMetadata<?> metadata) { super(metadata);
}
...
}
The compiler complains about : The constructor
BeanPath(PathMetadata<capture#2-of ?>) is undefined.
This is really out of my expertise now, so far what
I got when using querydsl with JPA in that case was
a StringPath.
C. Thomas
-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Timo
Westkämper
Sent: 26 September 2011 15:50
To: <email address hidden>
Subject: [Bug 856099] Re: Map entity property throws a NPE
Could you provide a minimal example project where this fails? I have not yet
been able to reproduce this issue.
** Changed in: querydsl
Status: New => In Progress
** Changed in: querydsl
Importance: Undecided => High
Bug description:
I have the following entity classes, beside a couple of other (so far
non critical).
@Entity(value = "USER", noClassnameStored = true)
public class User implements IUser, UserDetails, Account {
....
@Embedded
private Map<String, UserAttribute> properties;
....
//usual getter an setters
}
@Embedded
public class UserAttribute implements IAttribute {
//simple property values (String, Object or Date)
}
When i generate the sources with mvn i run into:
An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.NullPointerException
at
com.mysema.query.apt.ExtendedTypeFactory.createMapType(ExtendedTypeFactory.j
ava:234)
at
com.mysema.query.apt.ExtendedTypeFactory.createInterfaceType(ExtendedTypeFac
tory.java:366)
at
com.mysema.query.apt.ExtendedTypeFactory.handleDeclaredType(ExtendedTypeFact
ory.java:462)
at
com.mysema.query.apt.ExtendedTypeFactory.handle(ExtendedTypeFactory.java:441
)
at
com.mysema.query.apt.ExtendedTypeFactory.createType(ExtendedTypeFactory.java
:158)
at
com.mysema.query.apt.ExtendedTypeFactory.getType(ExtendedTypeFactory.java:15
1)
at
com.mysema.query.apt.ElementHandler.handleMethodProperty(ElementHandler.java
:182)
at
com.mysema.query.apt.ElementHandler.handleEntityType(ElementHandler.java:104
)
at com.mysema.query.apt.Processor.process(Processor.java:467)
at com.mysema.query.apt.Processor.processEntities(Processor.java:669)
at com.mysema.query.apt.Processor.processAnnotations(Processor.java:181)
at com.mysema.query.apt.Processor.process(Processor.java:127)
at
com.mysema.query.mongodb.morphia.MorphiaAnnotationProcessor.process(MorphiaA
nnotationProcessor.java:
54)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(Java
cProcessingEnvironment.j
ava:625)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProc
s(JavacProcessingEnviron
ment.java:554)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(Javac
ProcessingEnvironment.ja
va:699)
at
com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:9
81)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
at com.sun.tools.javac.main.Main.compile(Main.java:353)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:115)
at
com.mysema.maven.apt.AbstractProcessorMojo.execute(AbstractProcessorMojo.jav
a:210)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPl
uginManager.java:105)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:577)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:324)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.ja
va:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.
java:409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Excluding the above user class by removing the entity annotation
leads to a successful source generation.
Hi,
Trying to create a simple example from the bottom up, however
I could not reproduce that either. However, removing all properties of the
entities and adding them step by step up again, I'm now getting
trouble to generate the sources again (same stacktrace as before)
@Entity(value = "PERSON", noClassnameStored = true) shindig. social. opensocial. model.Person {
public class Person implements
org.apache.
private static final long serialVersionUID = 1L;
@Id
private ObjectId objectId = null;
private String id;
....
// the next two methods are causing the trouble
@Override
public Map<String, ?> getAppData() {
return personAppData;
}
@Override Map<String, ?> appData) { keySet( ).iterator( ); iterator
public void setAppData(
Map<String, String> m = new HashMap<String, String>();
for (Iterator<String> iterator =
appData.
.hasNext();) {
String k = iterator.next();
String v = (String) appData.get(k);
m.put(k, v);
}
personAppData = m;
}
Once these 2 methods are removed at least the source generation runs
through, however there is now
A Qstring class generated with compiler errors:
public class QString extends BeanPath {
...
public QString( BeanPath< String> entity) {
super( entity. getMetadata( ));
}
public QString( PathMetadata< ?> metadata) {
super( metadata) ;
}
...
}
The compiler complains about : The constructor PathMetadata< capture# 2-of ?>) is undefined.
BeanPath(
This is really out of my expertise now, so far what
I got when using querydsl with JPA in that case was
a StringPath.
C. Thomas
-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Timo
Westkämper
Sent: 26 September 2011 15:50
To: <email address hidden>
Subject: [Bug 856099] Re: Map entity property throws a NPE
Could you provide a minimal example project where this fails? I have not yet
been able to reproduce this issue.
** Changed in: querydsl
Status: New => In Progress
** Changed in: querydsl
Importance: Undecided => High
-- /bugs.launchpad .net/bugs/ 856099
You received this bug notification because you are subscribed to the bug
report.
https:/
Title:
Map entity property throws a NPE
Status in Querydsl:
In Progress
Bug description:
I have the following entity classes, beside a couple of other (so far
non critical).
@Entity(value = "USER", noClassnameStored = true)
public class User implements IUser, UserDetails, Account {
....
@Embedded
private Map<String, UserAttribute> properties;
....
//usual getter an setters
}
@Embedded
public class UserAttribute implements IAttribute {
//simple property values (String, Object or Date)
}
When i generate the sources with mvn i run into:
An annotation processor threw an uncaught exception. lang.NullPointe rException query.apt. ExtendedTypeFac tory.createMapT ype(ExtendedTyp eFactory. j query.apt. ExtendedTypeFac tory.createInte rfaceType( ExtendedTypeFac query.apt. ExtendedTypeFac tory.handleDecl aredType( ExtendedTypeFac t query.apt. ExtendedTypeFac tory.handle( ExtendedTypeFac tory.java: 441 query.apt. ExtendedTypeFac tory.createType (ExtendedTypeFa ctory.java query.apt. ExtendedTypeFac tory.getType( ExtendedTypeFac tory.java: 15 query.apt. ElementHandler. handleMethodPro perty(ElementHa ndler.java query.apt. ElementHandler. handleEntityTyp e(ElementHandle r.java: 104 query.apt. Processor. process( Processor. java:467) query.apt. Processor. processEntities (Processor. java:669) query.apt. Processor. processAnnotati ons(Processor. java:181) query.apt. Processor. process( Processor. java:127) query.mongodb. morphia. MorphiaAnnotati onProcessor. process( MorphiaA sor.java: tools.javac. processing. JavacProcessing Environment. callProcessor( Java ronment. j tools.javac. processing. JavacProcessing Environment. discoverAndRunP roc ngEnviron tools.javac. processing. JavacProcessing Environment. doProcessing( Javac onment. ja tools.javac. main.JavaCompil er.processAnnot ations( JavaCompiler. java:9 tools.javac. main.JavaCompil er.compile( JavaCompiler. java:727) tools.javac. main.Main. compile( Main.java: 353) tools.javac. api.JavacTaskIm pl.call( JavacTaskImpl. java:115) maven.apt. AbstractProcess orMojo. execute( AbstractProcess orMojo. jav maven.plugin. DefaultBuildPlu ginManager. executeMojo( DefaultBuildPl java:105) maven.lifecycle .DefaultLifecyc leExecutor. execute( DefaultLifecycl e maven.lifecycle .DefaultLifecyc leExecutor. execute( DefaultLifecycl e maven.DefaultMa ven.doExecute( DefaultMaven. java:247) maven.DefaultMa ven.execute( DefaultMaven. java:104) maven.cli. MavenCli. execute( MavenCli. java:427) maven.cli. MavenCli. doMain( MavenCli. java:157) maven.cli. MavenCli. main(MavenCli. java:121) NativeMethodAcc essorImpl. invoke0( Native Method) NativeMethodAcc essorImpl. invoke( NativeMethodAcc essorImpl. java:39 DelegatingMetho dAccessorImpl. invoke( DelegatingMetho dAccessorImpl reflect. Method. invoke( Method. java:597) plexus. classworlds. launcher. Launcher. launchEnhanced( Launcher. ja plexus. classworlds. launcher. Launcher. launch( Launcher. java:230) plexus. classworlds. launcher. Launcher. mainWithExitCod e(Launcher. plexus. classworlds. launcher. Launcher. main(Launcher. java:352)
Consult the following stack trace for details.
java.
at
com.mysema.
ava:234)
at
com.mysema.
tory.java:366)
at
com.mysema.
ory.java:462)
at
com.mysema.
)
at
com.mysema.
:158)
at
com.mysema.
1)
at
com.mysema.
:182)
at
com.mysema.
)
at com.mysema.
at com.mysema.
at com.mysema.
at com.mysema.
at
com.mysema.
nnotationProces
54)
at
com.sun.
cProcessingEnvi
ava:625)
at
com.sun.
s(JavacProcessi
ment.java:554)
at
com.sun.
ProcessingEnvir
va:699)
at
com.sun.
81)
at com.sun.
at com.sun.
at com.sun.
at
com.mysema.
a:210)
at
org.apache.
uginManager.
at
org.apache.
Executor.java:577)
at
org.apache.
Executor.java:324)
at org.apache.
at org.apache.
at org.apache.
at org.apache.
at org.apache.
at sun.reflect.
at
sun.reflect.
)
at
sun.reflect.
.java:25)
at java.lang.
at
org.codehaus.
va:290)
at
org.codehaus.
at
org.codehaus.
java:409)
at
org.codehaus.
Excluding the above user class by removing the entity annotation
leads to a successful source generation.
version apt 1.0.2, version dsl 2.2.2
Any ideas? I tried playing with
<querydsl. mapAccessors> false</ querydsl. mapAccessors>
and mapAccessors> true</querydsl. mapAccessors>
<querydsl.
but this seems to have no effect, even omitting the option completely
yields the same error result.
To manage notifications about this bug go to: /bugs.launchpad .net/querydsl/ +bug/856099/ +subscriptions
https:/