Good evening. I'm new user with hibernate and I need change all my project and put hibernate.
I have next doubts:
1- How could I put the password and user from my java application to hibernate.hbm.xml file.
Right now I have this: <hibernate-configuration> <session-factory> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/clinica</property> <property name="hibernate.connection.username">clinica</property> <property name="hibernate.connection.password">clinica</property> <property name="hibernate.show_sql">true</property> <mapping resource="hibernate/Param.hbm.xml"/> </session-factory> </hibernate-configuration>
Bu I would like pass user and password data from my java application.
2- The second doubt, how could I declare a compose key for a class definition, in the next text the key is "cod" but if I need declare cod+dni, how could I do it?
<id name="cod" type="string"> <column name="cod" length="3" /> <generator class="assigned" /> </id>
3- ¿What is better to use xml file or anotations?
4- Between criteria, HQL and SQL what do you recomendate me?
5- ¿How could I check if a database exist from hibernate code?
Excuse me for the long text. Thank you very much
|