4 Replies Latest reply on Feb 8, 2011 3:47 AM by Nicklas Karlsson

    Catalog "xxx" cannot be resolved for table

    Sam W Expert

      Hello,

       

      Dose anyone know how to resolve the following problem:

       

      Description    Resource    Path    Location    Type

      Catalog "houseware" cannot be resolved for table "category_images"    CategoryImages.java    /Houseware-jpa/src/au/com/housewareonline/persistence    line 19    Validation Message.

       

      My entity class is shown as below:

       

      import java.util.HashSet;

      import java.util.Set;

      import javax.persistence.Column;

      import javax.persistence.Entity;

      import javax.persistence.FetchType;

      import javax.persistence.Id;

      import javax.persistence.OneToMany;

      import javax.persistence.Table;

       

       

      /**

      * Role generated by hbm2java

      */

      @Entity

      @Table(name = "role", catalog = "houseware")

      public class Role implements java.io.Serializable {

       

       

          private int roleId;

          private String roleName;

          private Set<User> users = new HashSet<User>(0);

       

       

          public Role() {

          }

       

       

          public Role(int roleId) {

                this.roleId = roleId;

          }

       

       

          public Role(int roleId, String roleName, Set<User> users) {

                this.roleId = roleId;

                this.roleName = roleName;

                this.users = users;

          }

       

       

          @Id

          @Column(name = "role_id", unique = true, nullable = false)

          public int getRoleId() {

                return this.roleId;

          }

       

       

          public void setRoleId(int roleId) {

                this.roleId = roleId;

          }

       

       

          @Column(name = "role_name", length = 20)

          public String getRoleName() {

                return this.roleName;

          }

       

       

          public void setRoleName(String roleName) {

                this.roleName = roleName;

          }

       

       

          @OneToMany(fetch = FetchType.LAZY, mappedBy = "role")

          public Set<User> getUsers() {

                return this.users;

          }

       

       

          public void setUsers(Set<User> users) {

                this.users = users;

          }

       

       

      }

       

       

      Thanks

      Sam

        • 1. Catalog "xxx" cannot be resolved for table
          Sam W Expert

          Hello,

           

          Here is another Hibernate generated class: It also highed:

          1. the Catalog = "houseware" has an error message "Catalog "houseware" cannot be resolved for table "role""

          2: "Class Role" has an error message "The serializable class Role does not declare a static final serialVersionUID field of type long".

          If I added " private static final long serialVersionUID = 1L;" to the Class, the second error is gone.

          If I remove "catalog = "houseware"" , the first error is gone.

          But why can't I have catalog for the Class?

           

          Here is the generated source code:

           

          package au.com.houseware.persistence;

           

           

          // Generated 08/02/2011 12:30:34 AM by Hibernate Tools 3.4.0.CR1

           

           

          import java.util.HashSet;

          import java.util.Set;

          import javax.persistence.Column;

          import javax.persistence.Entity;

          import javax.persistence.FetchType;

          import javax.persistence.Id;

          import javax.persistence.OneToMany;

          import javax.persistence.Table;

           

           

          /**

          * Role generated by hbm2java

          */

          @Entity

          @Table(name = "role", catalog = "houseware")

          public class Role implements java.io.Serializable {

           

           

                    private int roleId;

                    private String roleName;

                    private Set<User> users = new HashSet<User>(0);

           

           

                    public Role() {

                    }

           

           

                    public Role(int roleId) {

                              this.roleId = roleId;

                    }

           

           

                    public Role(int roleId, String roleName, Set<User> users) {

                              this.roleId = roleId;

                              this.roleName = roleName;

                              this.users = users;

                    }

           

           

                    @Id

                    @Column(name = "role_id", unique = true, nullable = false)

                    public int getRoleId() {

                              return this.roleId;

                    }

           

           

                    public void setRoleId(int roleId) {

                              this.roleId = roleId;

                    }

           

           

                    @Column(name = "role_name", length = 20)

                    public String getRoleName() {

                              return this.roleName;

                    }

           

           

                    public void setRoleName(String roleName) {

                              this.roleName = roleName;

                    }

           

           

                    @OneToMany(fetch = FetchType.LAZY, mappedBy = "role")

                    public Set<User> getUsers() {

                              return this.users;

                    }

           

           

                    public void setUsers(Set<User> users) {

                              this.users = users;

                    }

           

           

          }

           

           

          Thanks

          Sam

          • 2. Catalog "xxx" cannot be resolved for table
            Nicklas Karlsson Master

            You're running against a DB that supports the catalog concept?

            • 3. Catalog "xxx" cannot be resolved for table
              Sam W Expert

              Oh.. no.

              So I can remove that?

               

              Thanks

              Sam

              • 4. Catalog "xxx" cannot be resolved for table
                Nicklas Karlsson Master

                Should be optional yes (and you spent more time asking the question than it would have taken to test it) ;-)