-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Hibernate Settings
PostPosted: Wed Apr 17, 2013 3:24 am 
Newbie

Joined: Wed Apr 17, 2013 2:41 am
Posts: 4
Hi! I have a problem trying move my configuration database to another computer. My boss wants the application and hibernate settings are in different places, this is possible?
The application should ignore what is the database used, if in the future we change the database the application not realize.
In the applicacion only should be the connection server: url, port...and in the server the connection database...all these are ideas, but I don´t know if is possible

If this is not possible, for each application means we should have a connection file database without any encapsulation of the connection to the database?

Sorry by my language, I hope understand me


Top
 Profile  
 
 Post subject: Re: Hibernate Settings
PostPosted: Wed Apr 17, 2013 3:34 am 
Regular
Regular

Joined: Wed Apr 10, 2013 1:02 am
Posts: 50
I really cannot understand what exactly you are asking
application and hibernate settings are in different places

_________________
Regards
Akash Miital
http://akash.thegrassroots.co.in/hibernate/


Top
 Profile  
 
 Post subject: Re: Hibernate Settings
PostPosted: Wed Apr 17, 2013 3:51 am 
Newbie

Joined: Wed Apr 17, 2013 2:41 am
Posts: 4
I mean hibernate settings would be out my application, inside application can´t be reference to database.

I develope my application on a computer, and hibernate should be in other computer (server), and when I need data of my database, I connect to server where I would have hibernate

If not explain well ask me

Thanks


Top
 Profile  
 
 Post subject: Re: Hibernate Settings
PostPosted: Wed Apr 17, 2013 4:09 am 
Regular
Regular

Joined: Wed Apr 10, 2013 1:02 am
Posts: 50
Still dint get it .... it would be better if you give an example like what comprise your application and configuration.

_________________
Regards
Akash Miital
http://akash.thegrassroots.co.in/hibernate/


Top
 Profile  
 
 Post subject: Re: Hibernate Settings
PostPosted: Wed Apr 17, 2013 4:40 am 
Newbie

Joined: Wed Apr 17, 2013 2:41 am
Posts: 4
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


Top
 Profile  
 
 Post subject: Re: Hibernate Settings
PostPosted: Wed Apr 17, 2013 4:53 am 
Regular
Regular

Joined: Wed Apr 10, 2013 1:02 am
Posts: 50
If i understood it correctly only solution seems is, you pack every thing related to hibernate in a jar file and give it to the
developer ...

_________________
Regards
Akash Miital
http://akash.thegrassroots.co.in/hibernate/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.