An update on this..I could resolve it myself. I changed the import of Post 
in eclipse to static import of Post.POSTS. And then I used POSTS.id. It 
worked.
(I am unable to do a static import of the entire Post class. Need to figure 
out why)

Thanks!

Regards,
Ankita

On Wednesday, July 8, 2015 at 5:03:08 PM UTC+5:30, [email protected] 
wrote:
>
> Hi,
>
> I am trying to setup jooq for the first time. I have a sample application 
> wherein I am trying to connect to a db having a table Posts in the database 
> guestbook. PFA the generated  java file for this table and below is the sql 
> I used to create this table.
>
> mysql> use guestbook;
> Database changed
>
> mysql> CREATE TABLE `posts` (
>     ->   `id` bigint(20) NOT NULL,
>     ->   `body` varchar(255) DEFAULT NULL,
>     ->   `timestamp` datetime DEFAULT NULL,
>     ->   `title` varchar(255) DEFAULT NULL,
>     ->   PRIMARY KEY (`id`)
>     -> );
> Query OK, 0 rows affected (1.34 sec)
>
> I used the following command to generate the tables :
>
> c:\Ankita\temp>java -classpath 
> jooq-3.6.2.jar;jooq-meta-3.6.2.jar;jooq-codegen-3.6.2.jar;mysql-connector-java-5.1.35-bin.jar;.
>  
> org.jooq.util.GenerationTool /jooq.xml
>
> Also, PFA my xml file.
>
> The problem I am facing is when I am trying to reference the ID field of 
> Posts class in java in my app, like this :
>
> Long id = r.getValueAsLong(Posts.ID);
>
> It gives an error 
> Description Resource Path Location Type
> Cannot make a static reference to the non-static field Posts.ID   
>  JooqMainApp.java /JooQSample/src line 32 Java Problem
>
> That is right because ID field is not static in the generate Posts.java 
> class. How should I fix it in this case?
>
> While I was reading on this further, I read somewhere that instanceFields 
> property in code generator config might help on this. But seems its 
> deprecated as of jOOQ 3.3.0.
>
> Any help on this would be very much appreciated.
>
> Thanks in advance!
>
> Regards,
> Ankita
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to