Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

(eclipse 3.4,JBOSS, JPA)in annotation "@Table" : " table cannot be resolved

843830Feb 27 2009
hello,

here is the software I use : eclipse ganymède (eclipse JEE), JBOSS 4.2.2, and I have a problem with a new project I created.
In eclipse, I created an "enterprise application project", and as I wanted to add some entities (3) to it, I created a "JPA project".
In the generation screen of the JPA project, I enabled the item "add to an EAR".
I modified the JBOSS files to use MySQL with it( it consisted in : adding the mysql-connector JAR, modify a mysql-ds.xml file, modify a standardjbosscmp-jdbc.xml file, and finally modify a login-config.xml file).
I added 3 files to the JPA project, here is one:
<br />
package source;<br />
<br />
import java.io.Serializable;<br />
import java.util.List;<br />
<br />
import javax.persistence.CascadeType;<br />
import javax.persistence.Column;<br />
import javax.persistence.Entity;<br />
import javax.persistence.FetchType;<br />
import javax.persistence.GeneratedValue;<br />
import javax.persistence.GenerationType;<br />
import javax.persistence.Id;<br />
import javax.persistence.OneToMany;<br />
import javax.persistence.OrderBy;<br />
import javax.persistence.PrePersist;<br />
import javax.persistence.PreUpdate;<br />
import javax.persistence.Table;<br />
<br />
import com.yaps.petstore.exception.ValidationException;<br />
<br />
@Entity<br />
@Table(name="t_category", schema = "petstore2")<br />
public class Category implements Serializable{<br />
    <br />
    /**<br />
     *<br />
     */<br />
    private static final long serialVersionUID = 4685727800817273144L;<br />
<br />
    public Category() {<br />
        super();<br />
    }<br />
<br />
    @Id<br />
    @GeneratedValue(strategy=GenerationType.AUTO)<br />
    private Long Id;<br />
    <br />
    @Column ( nullable=false , length=30 )<br />
    private String name;<br />
    <br />
   (...)
I have the following error (among many others) :
<br />
Table "t_category" cannot be resolved
<br />
In eclipse, I have enabled the JPA view, and it shows me it:
<br />
JPA details:<br />
type 'source.Category' is mapped as entity.<br />
Name : Default(Category)<br />
<br />
TABLE:<br />
Name : t_category<br />
Catalog : Default()<br />
Schema : petstore2<br />
<br />
I don't know what to enter for the Catalog.
I think this is an error of configuration but where?

NB: there are errors at the annotations Id and Column.

Here is the file persistence.xml :
<br />
<persistence><br />
    <persistence-unit name="IntroEJB3"><br />
        <jta-data-source>java:/MySqlDS</jta-data-source><br />
        <properties><br />
            <property name="hibernate.hbm2ddl.auto" value="create"/><br />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/><br />
              <property name="hibernate.show_sql" value="true"/><br />
            <property name="hibernate.connection.password" value="petstorepwd"/><br />
            <property name="hibernate.connection.username" value="petstorelg"/> <br />
        </properties><br />
    </persistence-unit><br />
</persistence>
<br />
olivier.


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 27 2009
Added on Feb 27 2009
0 comments
247 views