Hello. Well i'm kind of a newbie on hibernate technology and i'm currently experiencing a problem.
i'll try to explian the best i can.
I have a sql database which schema is called thehiveschema (i can access it through netbeans so it is allright).
So, as far as i know, to consult, update or what else on the DB with hibernate i have to create a session and a transaction. So i have this code:
NUMBER 1
NUMBER 2
note that this code wasn't made by me but i assume it is right because i have searched for several examples online and they look like the same
my
hibernate.cfg.xml is like 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.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/thehivischema?zeroDateTimeBehavior=convertToNull</property>
<property name="hibernate.connection.username">Neves</property>
<property name="hibernate.connection.password">deisisec</property>
<mapping class="db_interaction.utilizador"></mapping>
</session-factory>
</hibernate-configuration>
Well when I execute number one I get: "Erro no hibernate: null" After debugging it i realized that the problem is on Session s = HibernateUtil.getSession();. Apparently this is null
can somebody helpe me on this?
thanks in advance