On 11/21/07, Henrik Lohse <[EMAIL PROTECTED]> wrote:
>
> Hello list,
>
> I am trying to set up my first appfuse project. I am using appfuse 2
> with hibernate and tapestry.
>
> Basically, I did the tutorial and now want to modify it:
>
> I have a table "project" (=the Person in the tutorial) and need it to
> have a key to the app_user table. Hence a logged in user can just see
> "his" projects. And projects newly created are assigned to the logged
> user.
>
> How do I manage the relation between the two tables ? Actually, it is
> just a one way mapping. every project has one app_user. the app_user
> does not know about the projects.
>
> my table looks like
>
> TABLE project
> Long id       (primary key)
> Long owner     (reference to the app_user.id
> String name varchar(100) (some data)
>
> Should my owner attribute be of type Long or of type
> org.appfuse.model.User ?


Very much up to you. With the former (Long) you will have to do a separate
lookup to get the user object. With the later Hibernate will load it for you
along with Project instance.

How should this be mapped to/done with hibernate ?
> Any hint on where to find some documentation/example would be
> appreciated very much!


There are two documents well worth taking a look at if you are new to
Hibernate (along with loads of articles, books, etc - just google for
these). The first is the Hibernate core manual:
http://www.hibernate.org/hib_docs/v3/reference/en/html/ , the second is the
Hibernate annotations documentation:
http://www.hibernate.org/hib_docs/annotations/reference/en/html/

Mike.

Thanks in advance
> Henrik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to