sql - non-static variable role cannot be referenced from a static context- JDO Querydsl -


i building 1 maven project using jdo, querydsl. in daoimpl class 1 line showing error is: "non-static variable role cannot referenced static context"

my pojo classes are: user.java

@persistencecapable(table="user_login") public class user { @primarykey @column(name="user_id") private integer userid=0; @column(name="user_profile_name") private string userprofilename=null;   @column(name="user_email") private string useremail=null; @column(name="user_contact") private string usercontact=null; @column(name="user_name") private string username=null; @column(name="user_password") private string userpassword=null; @column(name="user_role_id") private integer userroleid=0;  private role userrole=null; 

role.java:

   @persistencecapable(table="user_role")     public class role {     @primarykey     @column(name="id")     private integer roleid=0;     @column(name="role")     private string role=null;    

my required result be:

userid: 1, role: admin

my daoimpl class:

public list<user> getuser(string user_name, string user_password) {     persistencemanager pm =          this.persistencemanagerfactory.getpersistencemanager();     transaction tx = pm.currenttransaction();          sqltemplates templates = new mysqltemplates();              quser user = quser.user;     qrole role = qrole.role;-----------**this showing error**           jdosqlquery query = new jdosqlquery(pm, templates);     try {     // start transaction     tx.begin();      list<user> result = query.from(user)                   .innerjoin(role).on(user.userroleid.eq(role.roleid))                   .where(user.username.eq(user_name),               user.userpassword.eq(user_password)).              list(user);                    query.close();     tx.commit();     return result;     }     {         if (tx.isactive())         {             // error occurred rollback transaction             tx.rollback();         }         pm.close();     }  

my pom.xml is:

    <project xmlns="http://maven.apache.org/pom/4.0.0"       xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"      xsi:schemalocation="http://maven.apache.org/pom/4.0.0        http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion>  <groupid>com.titas</groupid> <artifactid>querydsljdo</artifactid> <version>1.0-snapshot</version> <packaging>war</packaging>  <name>querydsljdo</name>  <properties>     <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>     <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties>  <dependencies>     <dependency>         <groupid>javax</groupid>         <artifactid>javaee-web-api</artifactid>         <version>6.0</version>         <scope>provided</scope>     </dependency>     <dependency>         <groupid>javax.servlet</groupid>         <artifactid>javax.servlet-api</artifactid>         <version>3.1.0</version>     </dependency>      <dependency>         <groupid>javax.servlet.jsp</groupid>         <artifactid>jsp-api</artifactid>         <version>2.1</version>         <scope>provided</scope>     </dependency>     <dependency>          <groupid>jstl</groupid>          <artifactid>jstl</artifactid>          <version>1.2</version>      </dependency>     <dependency>         <groupid>org.springframework</groupid>         <artifactid>spring-webmvc</artifactid>         <version>4.1.6.release</version>     </dependency>     <dependency>         <groupid>org.springframework</groupid>         <artifactid>spring-tx</artifactid>         <version>4.1.6.release</version>     </dependency>     <dependency>         <groupid>org.springframework</groupid>         <artifactid>spring-orm</artifactid>         <version>4.1.6.release</version>     </dependency>     <dependency>         <groupid>org.springframework</groupid>         <artifactid>spring-jdbc</artifactid>         <version>4.1.6.release</version>     </dependency>     <dependency>         <groupid>org.springframework</groupid>         <artifactid>spring-aspects</artifactid>         <version>4.1.6.release</version>     </dependency>     <dependency>         <groupid>mysql</groupid>         <artifactid>mysql-connector-java</artifactid>         <version>5.1.6</version>     </dependency>      <dependency>         <groupid>javax.jdo</groupid>         <artifactid>jdo-api</artifactid>         <version>3.0.1</version>     </dependency>     <dependency>         <groupid>com.mysema.querydsl</groupid>         <artifactid>querydsl-apt</artifactid>         <version>3.6.3</version>         <scope>provided</scope>     </dependency>                 <dependency>       <groupid>com.mysema.querydsl</groupid>       <artifactid>querydsl-jdo</artifactid>       <version>3.6.3</version>     </dependency>     <dependency>         <groupid>com.mysema.querydsl</groupid>         <artifactid>querydsl-sql</artifactid>         <version>3.6.3</version>     </dependency>     <dependency>       <groupid>org.slf4j</groupid>       <artifactid>slf4j-log4j12</artifactid>       <version>1.6.1</version>     </dependency>  </dependencies>  <build>     <plugins>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-compiler-plugin</artifactid>             <version>2.3.2</version>             <configuration>                 <source>1.6</source>                 <target>1.6</target>                 <compilerarguments>                     <endorseddirs>${endorsed.dir}</endorseddirs>                 </compilerarguments>             </configuration>         </plugin>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-war-plugin</artifactid>             <version>2.1.1</version>             <configuration>                 <failonmissingwebxml>false</failonmissingwebxml>             </configuration>         </plugin>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-dependency-plugin</artifactid>             <version>2.1</version>             <executions>                 <execution>                     <phase>validate</phase>                     <goals>                         <goal>copy</goal>                     </goals>                     <configuration>                         <outputdirectory>${endorsed.dir}                         </outputdirectory>                         <silent>true</silent>                         <artifactitems>                             <artifactitem>                                 <groupid>javax</groupid>                                 <artifactid>javaee-endorsed-                                  api</artifactid>                                 <version>6.0</version>                                 <type>jar</type>                             </artifactitem>                         </artifactitems>                     </configuration>                 </execution>             </executions>         </plugin>          <plugin>             <groupid>com.mysema.maven</groupid>             <artifactid>apt-maven-plugin</artifactid>             <version>1.0.4</version>             <executions>               <execution>                 <goals>                   <goal>process</goal>                 </goals>                 <configuration>                   <outputdirectory>target/generated-sources                    /java</outputdirectory>                   <processor>com.mysema.query.apt.jdo.                    jdoannotationprocessor</processor>                 </configuration>               </execution>             </executions>         </plugin>          <plugin>             <groupid>com.mysema.querydsl</groupid>             <artifactid>querydsl-maven-plugin</artifactid>             <version>2.9.0</version>             <executions>               <execution>                 <goals>                   <goal>export</goal>                 </goals>               </execution>                         </executions>             <configuration>               <jdbcdriver>com.mysql.jdbc.driver</jdbcdriver>               <jdbcurl>jdbc:mysql://localhost:3306/login</jdbcurl>               <jdbcuser>root</jdbcuser>               <packagename>com.titas.model</packagename>               <targetfolder>${project.basedir}/target/generated-sources                /java</targetfolder>              </configuration>             <dependencies>               <dependency>                     <groupid>mysql</groupid>                     <artifactid>mysql-connector-java</artifactid>                     <version>5.1.6</version>               </dependency>             </dependencies>         </plugin>             </plugins>     <resources>         <resource>             <directory>src/main/resources</directory>         </resource>     </resources> </build> 

since role.java contains property 'role' querydsl cannot generate standard variable 'qrole.role', named 'qrole.role1'.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -