Thanks for the information this far,

I have used hibernate-tools to reverse engineer my tables and I built a
small test database to try to work with a foreign key but so far I cannot
get it to work.

My tables are simple:
Users
Userid INTEGER
FirstName VARCHAR
LastName VARCHAR
Ocid INTEGER(The foreign key to occupation)

Occupation
Ocid INTEGER
Ocname VARCHAR

When I generate them using hibernate tools I still have to add the:
@Entity
@Table(name="occupation")
For the table and
@Id
@GeneratedValue
For the id.

The problem is, when I try to run it I get this error:
Could not determine type for: java.util.Set, for columns:
[org.hibernate.mapping.Column(userses)]

This is the foreign key so I assume it is not being generated correctly.

Any help would be appreciated.  Below is my 2 classes;

@Entity
@Table(name="users")
public class Users {

        @Id
    @GeneratedValue
        private Integer userid;
        private Occupation occupation;
        private String firstName;
        private String lastName;

        public Users() {
        }

        public Users(Occupation occupation) {
                this.occupation = occupation;
        }

        public Users(Occupation occupation, String firstName, String
lastName) {
                this.occupation = occupation;
                this.firstName = firstName;
                this.lastName = lastName;
        }

        public Integer getUserid() {
                return this.userid;
        }

        public void setUserid(Integer userid) {
                this.userid = userid;
        }

        public Occupation getOccupation() {
                return this.occupation;
        }

        public void setOccupation(Occupation occupation) {
                this.occupation = occupation;
        }

        public String getFirstName() {
                return this.firstName;
        }

        public void setFirstName(String firstName) {
                this.firstName = firstName;
        }

        public String getLastName() {
                return this.lastName;
        }

        public void setLastName(String lastName) {
                this.lastName = lastName;
        }

}

@Entity
@Table(name="occupation")
public class Occupation {

        @Id
    @GeneratedValue
        private Integer ocid;
        private String ocnamev;
        private Set userses = new HashSet(0);

        public Occupation() {
        }

        public Occupation(String ocnamev) {
                this.ocnamev = ocnamev;
        }

        public Occupation(String ocnamev, Set userses) {
                this.ocnamev = ocnamev;
                this.userses = userses;
        }

        public Integer getOcid() {
                return this.ocid;
        }

        public void setOcid(Integer ocid) {
                this.ocid = ocid;
        }

        public String getOcnamev() {
                return this.ocnamev;
        }

        public void setOcnamev(String ocnamev) {
                this.ocnamev = ocnamev;
        }

        public Set getUserses() {
                return this.userses;
        }

        public void setUserses(Set userses) {
                this.userses = userses;
        }

}




-----Original Message-----
From: BarryDev [mailto:[EMAIL PROTECTED] 
Sent: October-26-08 10:35 AM
To: users@tapestry.apache.org
Subject: RE: T5: Using with hibernate and Mysql


Oh forgot that I'd change the field's name to match the column in that
class. 
If you want to explicitly join a field to a column use the @JoinColumn(name
= "whatever") annotation.
-- 
View this message in context:
http://www.nabble.com/T5%3A-Using-with-hibernate-and-Mysql-tp20166018p201735
23.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


__________ Information from ESET Smart Security, version of virus signature
database 3536 (20081019) __________

The message was checked by ESET Smart Security.

http://www.eset.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to