I am using java swing + hibernate. Not sure how to use hibernate with swing.
Following is my persistence,
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd ">
<persistence-unit name="mypu">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.example.Student</class>
<!-- there are more entities -->
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/mydb" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="root" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
Not sure I am doing write or not. I have DAO calss for each entity class and it looks like
class StudentDAO {
private EntityManagerFactory emf;
private EntityManager em;
public StudentDAO()
{
emf = Persistence.createEntityManagerFactory("mypu");
em = emf.createEntityManager();
}
}
So each DAO class has above code.
When I run project It shows following message about 8-10 times in console. Thats why it taking time to run project.
Jun 26, 2016 9:46:13 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!) Jun 26, 2016 9:46:13 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/mydb] Jun 26, 2016 9:46:13 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000046: Connection properties: {user=root, password=****} Jun 26, 2016 9:46:13 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000006: Autocommit mode: false Jun 26, 2016 9:46:13 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20 (min=1) Jun 26, 2016 9:46:13 AM org.hibernate.dialect.Dialect INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect Jun 26, 2016 9:46:13 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory
INFO: HHH000397: Using ASTQueryTranslatorFactory Jun 26, 2016 9:46:13 AM org.hibernate.tool.hbm2ddl.SchemaValidator validate INFO: HHH000229: Running schema validator Jun 26, 2016 9:46:13 AM org.hibernate.tool.hbm2ddl.SchemaValidator validate INFO: HHH000102: Fetching database metadata Jun 26, 2016 9:46:13 AM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000261: Table found: mydb.student Jun 26, 2016 9:46:13 AM org.hibernate.tool.hbm2ddl.TableMetadata INFO: HHH000037: Columns: [id, name, address] org.hibernate.jpa.internal.EntityManagerFactoryRegistry addEntityManagerFactory
WARN: HHH000436: Entity manager factory name (mypu) is already registered. If entity manager will be clustered or passivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name' Jun 26, 2016 9:46:13 AM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead. Jun 26, 2016 9:46:13 AM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead. Jun 26, 2016 9:46:13 AM org.hibernate.ejb.HibernatePersistence logDeprecation
WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead. Jun 26, 2016 9:46:13 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation INFO: HHH000204: Processing PersistenceUnitInfo [ name: mypu
Why it is showing above message so many times? Thank you for help !!