My add code works for every object expect the new table I just added (Report). I can't seem to find the problem and i just get this error:
Could not execute statement when using .save(object)
Report.hbm.xml
<hibernate-mapping>
<class name="com.atp.Models.Report" table="report">
<meta attribute="class-description">
This class contains the report details.
</meta>
<id name="environmentName" type="string" column="environmentName">
<generator class="native"/>
</id>
<property name="individual" column="Individual" type="int"/>
<property name="corporation" column="Corporation" type="int"/>
<property name="dda" column="DDA" type="int"/>
<property name="sav" column="SAV" type="int"/>
<property name="mtg" column="MTG" type="int"/>
<property name="sepaOut" column="SEPAOUT" type="int"/>
<property name="sepaIn" column="SEPAIN" type="int"/>
<property name="atm" column="ATM" type="int"/>
</class>
MySqL Table
Java Add to database (all the fields are right)
//Create new object
Report report = new Report();
report.setEnvironmentName(environmentName);
report.setIndividual(individual);
report.setCorporation(corporation);
report.setDda(dda);
report.setSav(sav);
report.setMtg(mtg);
report.setSepaIn(sepaIn);
report.setSepaOut(sepaOut);
report.setAtm(atm);
ManageCreation.AddToDatabase(report);
public static void AddToDatabase(Object object) {
SessionFactory factory = HibernateUtil.GetSessionFactory();
Session session = factory.openSession();
Transaction tx = null;
try{
tx = session.beginTransaction();
session.save(object);
tx.commit();
}catch (HibernateException e) {
if (tx!=null) tx.rollback();
e.printStackTrace();
}finally {
session.close();
}
}