Results 1 to 5 of 5
  1. #1
    nikhil_me is offline Member
    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Question unable to write (error free)entity class for which table doesn't exist

    Greetings!!!
    i am using eclipse and eclipselink for jpa with postgresql as database but I am not able to create table using java codes. when I write an entity class and add @entity eclipse starts giving compilation errors saying table and column can't be resolved but if i first create a table manually in database and then write the entity class with the same table name and column name as in database then no compilation error is found. How can i write error free entity class for which no table exist in the database.

    thanxxx

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: unable to write (error free)entity class for which table doesn't exist

    You can set the properties of your persistent unit so that it automatically create the table for you when it doesn't exist.

    <property name="eclipselink.ddl-generation" value="create-tables"/>

  3. #3
    nikhil_me is offline Member
    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Default Re: unable to write (error free)entity class for which table doesn't exist

    tried that already but it doesn't work. there are errors on the entity class but when I run it inspite of compilation errors, the table is created and the data is being persisted in the database
    but still the entity class has the errors (table and column can't be resolved) also on running the program console shows errors and list all previously created entities saying they all exist already but even then data is being persisted.
    previously i have used jpa with toplink and oracle as database so according to that i should not get any kind of error if data is being persisted nor it should display list of previously created entities. am i missing something???

  4. #4
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: unable to write (error free)entity class for which table doesn't exist

    What is the error? can you provide the error stack trace?

  5. #5
    nikhil_me is offline Member
    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Wink Re: unable to write (error free)entity class for which table doesn't exist

    problem got solved after i restarted eclipse. i was getting list of all tables with code error 0(don't know what that is) but when i removed create table property then i didn't get the list (but again not able to create table).

Similar Threads

  1. Package Doesn't exist - Issue with import
    By Sagars in forum New To Java
    Replies: 4
    Last Post: 08-08-2011, 06:36 PM
  2. error in creating the entity class by netbeans
    By javastuden in forum NetBeans
    Replies: 2
    Last Post: 07-22-2011, 02:29 PM
  3. Entity - Free For All
    By entity in forum Introductions
    Replies: 0
    Last Post: 11-15-2010, 10:09 AM
  4. getImage - not fail when image doesn't exist
    By leonid.ge in forum Java Applets
    Replies: 0
    Last Post: 07-24-2009, 04:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •