I’m learning Java EE 6 and I’m beginning with basic tutorials trying to really understand all the infrastructure and playing a little bit with it.
So I did a basic tutorial (this one) about using JPA. The only difference is that I changed the ObjectDB implementation for Hibernate.
It is very simple, it has an Entity, a DAO Session Bean, a Servlet and a JSP. The only thing that it does is that you register names and it shows the names to you. I configured Hibernate to work with a postgres database and in the persistence.xml file put the following:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="TutorialGuestBook1PU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/__default</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
Everything is working ok, but I cannot see where is being saved the information that I’m saving with the sample application. I know that it must be somewhere but I query the postgres database and I cannot find it.
Where should be the information? Is something about the default datasource or something like that? Can anyone light me?
Thanks in advance.
Best regards,
Here’s what I found when I searched “GlassFish default datasouce”, first hit:
http://docs.oracle.com/cd/E18930_01/html/821-2424/gksmw.html
IIRC it’s the same on the non-embedded, but haven’t checked in awhile. Simple enough search, though.