QueryDSL query not cast to object -


i querying querydsl sqlserver. beans generated @ build time using maven. runs fine until try convert results objects themselves.

@requestmapping("getabsencecauses") public list<causeofabsences> getabsencecauses() {      sqltemplates templates = new sqlservertemplates();     configuration configuration = new configuration(templates);     sqlqueryfactory queryfactory = new sqlqueryfactory(configuration, datasource);      causeofabsences absence = new causeofabsences("c");     list<causeofabsences> absencecauses = queryfactory.from(absence).list(absence);     return absencecauses; } 

at runtime getting following exception: java.lang.illegalargumentexception: relationalpath based projection can used generated bean types

another post says have " need generate bean types described here under bean class generation."

but these beans generated maven. there thing can tell maven generate these types? @ moment generating documented:

  <plugin>     <groupid>com.mysema.querydsl</groupid>     <artifactid>querydsl-maven-plugin</artifactid>     <version>${querydsl.version}</version>     <executions>       <execution>         <goals>           <goal>export</goal>         </goals>       </execution>     </executions>     <configuration>       <jdbcdriver>com.microsoft.sqlserver.jdbc.sqlserverdriver</jdbcdriver>       <jdbcurl>jdbc:sqlserver://t00-stemig.some.where:1433;databasename=test</jdbcurl>       <packagename>net.neobp.neo.query</packagename>       <targetfolder>${project.basedir}/target/generated-sources/java</targetfolder>       <jdbcuser>user</jdbcuser>       <jdbcpassword>pass</jdbcpassword>       <schemapattern>dbo</schemapattern>     </configuration>     <dependencies>       <dependency>         <groupid>com.microsoft</groupid>         <artifactid>sqljdbc4</artifactid>         <version>1.0.0</version>       </dependency>     </dependencies>   </plugin> 

ok, found myself:

in documentation there hint on other parameters can configured. found exportbeans property, indicates generate objects given query.

just added maven configuration section , worked.

      <schemapattern>dbo</schemapattern>       <exportbeans>true</exportbeans> 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -