-
1. Re: Newb database help
voreichel Mar 24, 2008 11:10 AM (in response to metal610)Hi Robert,
I'm not sure I got your message right. Especially I do not understand what you mean with
...access the database with just a function call
. So I will give you a typical seam scenario:
In Seam there are POJOs or entities which can be stored or retrieved from a database using either Hibernate or any other JPA framework. There is no need for a seam developer to use database connections and/or statements/prepared statements. All you have to do is specify (by annotations) which fields of a pojo or entity should be persistet. The runtime java object is linked to database rows/columns via an EntityManager or PersistenceContext. You only need to declare such a manager/context in your java code and provide a persistence unit (persistence.xml) and a datasource definition.Hope this helps to understand how seam works.
-
2. Re: Newb database help
metal610 Mar 25, 2008 1:54 PM (in response to metal610)That does help a bit. Although I'm still a bit lost on how to insert information into the database using entities. Is that a Hibernate thing or is there some special way of doing it? I'm used to using prepared statements like you said, so I have no idea what to do here.
Thanks,
Robert -
3. Re: Newb database help
mars1412 Mar 25, 2008 2:07 PM (in response to metal610)how about reading the seam reference, or studying the examples in your seam installations examples directory?
-
4. Re: Newb database help
metal610 Mar 25, 2008 2:22 PM (in response to metal610)I have been reading the reference and looking at the examples. My problem is that I'm needing to insert information into multiple tables in the DB at the same time from one page and all of the examples only deal with one table at a time from one page. Is there some way around this or did I just miss something?
-
5. Re: Newb database help
mars1412 Mar 25, 2008 2:46 PM (in response to metal610)do you mean smth. like this?
@Name("manager") public class Manager { EntityA entityA = new EntityA(); EntityB entityB = new EntityB(); //getter/setter for entities public String persist() { entityManager.persist(entityA); entityManager.persist(entityB); return "persisted"; } }
-
6. Re: Newb database help
metal610 Mar 25, 2008 2:55 PM (in response to metal610)Yeah. That was what I was talking about. Thanks.