I keep table schema in this file tableaddress.orm.xml
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="2.1"
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<entity class="Address">
<attributes>
<basic name="city" attribute-type="String" />
<basic name="country" attribute-type="int" />
<basic name="province" attribute-type="double" />
<basic name="postalCode" attribute-type="boolean">
</basic>
<basic name="street" attribute-type="String" />
</attributes>
</entity>
</entity-mappings>
Here is how I tried to create table using Hibernate
public class App
{
public static void main( String[] args )
{
Properties prop= new Properties();
prop.setProperty("hibernate.connection.url", "jdbc:mariadb:......");
prop.setProperty("dialect", "org.hibernate.dialect.MariaDB53Dialect");
prop.setProperty("hibernate.connection.username", "user");
prop.setProperty("hibernate.connection.password", "password");
prop.setProperty("hibernate.connection.driver_class", "org.mariadb.jdbc.Driver");
SessionFactory sessionFactory = new Configuration()
.addResource("tableaddress.orm.xml").addProperties(prop).buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
session.getTransaction().commit();
session.close();
}
}
It should work, there is no compile errors, but for some reason the table is not created
Error java.lang.NoClassDefFoundError: javax/transaction/SystemException