Ok, I'll try I did a little application on my computer, I use...Eclipse 4.2, downloaded Hibernate tools,and Postgresql and I did the application with gwt, it was a simple test,I could insert,delete,update,select books, all OK.
I had hibernate.cfg.xml with this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/pruebasAna</property> <property name="hibernate.connection.username">ana</property> <property name="hibernate.connection.password">*****</property> <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property> <property name="show_sql">true</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory </property> <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="hibernate.c3p0.min_size">5</property> <property name="hibernate.c3p0.max_size">20</property> <property name="hibernate.c3p0.timeout">1800</property> <property name="hibernate.c3p0.max_statements">50</property> <property name="hibernate.hbm2ddl.auto">update</property> <mapping resource="Libro.hbm.xml"/> </session-factory> </hibernate-configuration>
And Libro.hbm.xml this:
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated 07-mar-2013 8:50:24 by Hibernate Tools 3.4.0.CR1 --> <hibernate-mapping> <class name="pake.shared.Libro" table="LIBRO"> <id name="id" type="long"> <column name="ID" /> <generator class="increment" /> </id> <property name="titulo" type="string"> <column name="TITULO" /> </property> <property name="autor" type="string"> <column name="AUTOR" /> </property> <property name="anioPublicacion" type="int" access="field"> <column name="ANIOPUBLICACION" /> </property> </class> <query name="Consulta"> <![CDATA[from Libro where autor = :autor]]> </query> <query name="LibPubAutor"> <![CDATA[select titulo from Libro where autor = :autor]]> </query> <query name="DeleteLibro"> <![CDATA[delete Libro lib where lib.autor = :autor]]> </query> <query name="UpdateTitulo"> <![CDATA[update Libro lib set lib.titulo = :titulonuevo where lib.titulo = :titulo]]> </query> <query name="UpdateAutor"> <![CDATA[update Libro lib set lib.autor = :aactualizado where lib.autor = :autor]]> </query>
</hibernate-mapping>
Now...my boss says this files can´t see in my application, because the application developers don´t know NOTHING about database, he wants that hibernate.cfg.xml and Libro.hbm.xml are OUT of my application, he says I can download hibernate and run like application or similar, but I only find information about hibernate is only framework, a set of libraries...but he says that has to be the way. I develope the application on my computer and now the database will be in other computer, I should connect to server and hibernate run. I'm starting to think is impossible that the hibernate configuration is outside the application
Thank you very much for your effort
|