Hi Niet,
How do you get your primary key? Do you get it from your database, or do you get if from another source. If you get it from your database, you already know how to access that database. In the other case, you probably need some persistence framework to access your database. JPA is a good choice, with several implementations available (Hibernate, EclipseLink, and others...)
How to use a persistence framework is out of scope of this
JSF forum;
you should go to the
Object Relational Mapping forum for that.
Groeten :-)
Bart Kummel