Java Reference
In-Depth Information
{
@OneToOne(mappedBy="bellyButton")
private Person person;
public Person getPerson(){
return person;
}
public void getPerson(Person person){
this.person=person;
}
}
As we can see, the procedure to establish one-to-one relationships is very similar to
the procedure that is used to establish one-to-many and many-to-many relationships.
Once we have generated JPA entities from a database, we need to write additional
code containing business and presentation logic, alternatively, we can use NetBeans
to generate code for these two layers.
Generating JSF applications from JPA
entities
One very nice feature of NetBeans is that it allows us to generate JSF applications
that will perform Create, Read, Update, and Delete ( CRUD ) operations from
existing JPA entities. This feature, combined with the ability to create JPA entities
from an existing database schema as described in the previous section, allows us to
write web applications that interact with a database in record time.
To generate JSF pages from existing JPA entities, we need to right-click on the
project, select File | New File , then select the JavaServer Faces category and
the JSF Pages from Entity Classes file type.
In order for us to be able to generate JSF pages from existing JPA entities,
the current project must be a Web Application project.
 
Search WWH ::




Custom Search