How to Optimize Hibernate buildSessionFactory(); - java

**How to Optimize Hibernate buildSessionFactory();"
The method 'cfg.buildSessionFactory();' of Hibernate consumes a lot of CPU. And on low-end systems is taking more than 20 seconds.
Is there anyway I can cache it and just load manually?
Im stuck on optimizing this. Whats the proper way to make 'cfg.buildSessionFactory();' faster?
public static void initHibernate() throws Exception {
System.out.println("Initializing Hibernate.....");
String username = Cryptographer.decrypt(MySettings.getDb_username());
String password = Cryptographer.decrypt(MySettings.getDb_password());
String url = Cryptographer.decrypt(MySettings.getDb_url());
cfg = new Configuration()
.configure("hibernate.cfg.xml")
.setProperty("hibernate.connection.url", url)
.setProperty("hibernate.connection.username", username)
.setProperty("hibernate.connection.password", password)
.setProperty(username, url);
//Error: Hibernate Could not deserialize cache file:
//File fileAux = new File("A:\\hibernate.cfg.xml");
//cfg.addCacheableFile(fileAux);
sessions = cfg.buildSessionFactory();
}
Additional Information:
compile group: 'org.hibernate', name: 'hibernate-c3p0', version: '5.4.27.Final'
Mapping xml file: (I redacted private information as REDACTED)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- UPDATE OR NONE -->
<property name ="hibernate.hbm2ddl.auto">none</property>
<!-- -->
<property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="hibernate.connection.url"></property>
<property name="hibernate.connection.username"></property>
<property name="hibernate.connection.password"></property>
<!-- -->
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL8Dialect</property>
<property name="hibernate.order_updates">true</property>
<!-- Just set the correct isolation to default(1). Stops logging messages -->
<property name="hibernate.connection.isolation">1</property>
<!-- Might Improve Performance -->
<property name="hibernate.jdbc.batch_versioned_data">true</property>
<property name="hibernate.connection.autoReconnect">true</property>
<property name="hibernate.connection.autoReconnectForPools">true</property>
<!-- fix time zone -->
<property name="hibernate.jdbc.time_zone">UTC</property>
<!-- hibernate -->
<property name="hibernate.temp.use_jdbc_metadata_defaults">false</property>
<property name="hibernate.connection.pool_size">3</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.format_sql">false</property>
<property name="hibernate.jdbc.batch_size">360</property>
<property name="hibernate.max_fetch_depth">30</property>
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<!-- C3PO -->
<property name="hibernate.c3p0.max_size">3</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.timeout">240</property>
<property name="hibernate.c3p0.max_statements">180</property>
<property name="hibernate.c3p0.idle_test_period">30</property>
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.testConnectionOnCheckout">false</property>
<property name="hibernate.c3p0.testConnectionOnCheckin">true</property>
<property name="hibernate.c3p0.preferredTestQuery">SELECT 1</property>
<!-- Mapping -->
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
<mapping class="br.REDACTED.models.REDACTED"/>
</session-factory>
</hibernate-configuration>
References
https://forum.hibernate.org/viewtopic.php?p=2242766
https://developer.jboss.org/thread/197521
https://github.com/spring-projects/spring-framework/issues/18305
https://docs.jboss.org/hibernate/orm/5.2/topical/html_single/bytecode/BytecodeEnhancement.html

Related

Every time I run server my new table is being created and previous data are deleted

Whenever I run my server my database table are re-created and all my previous data are being deleted. I was thinking this might be the problem in hibernate configuration file but don't know the actual reason hope you awesome guys will figure me out .
I also tried changing <property name="hibernate.hbm2ddl.auto">update</property> to auto , validate but didnot help
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"http://www.hibernate.org/dtd/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.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<!-- Assume test is the database name -->
<property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/restro
</property>
<property name="hibernate.connection.username">
root
</property>
<property name="hibernate.connection.password">
root
</property>
<!-- <property name="connection.release_mode">auto</property> -->
<!-- Drop and re-create the database schema on startup -->
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Names the annotated entity class -->
<mapping class="com.restroo.model.MenuItems"/>
<mapping class="com.restroo.model.AdminUser"/>
</session-factory>
</hibernate-configuration>

first Hibernate test gives error [EDITED]

I'm an Hibernate beginner user, I created a very simple application to test it !
But I get this error in the console :
Initial SessionFactory creation failed.org.hibernate.HibernateException: Dialect class not found: org.openmeetings.app.hibernate.utils.MySQL5MyISAMDialect
Exception in thread "main" java.lang.ExceptionInInitializerError
at util.HibernateUtil.buildSessionFactory(HibernateUtil.java:20)
at util.HibernateUtil.<clinit>(HibernateUtil.java:10)
at DAO.services.addProduit(services.java:9)
at test.main(test.java:11)
Caused by: org.hibernate.HibernateException: Dialect class not found: org.openmeetings.app.hibernate.utils.MySQL5MyISAMDialect
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:81)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:422)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at util.HibernateUtil.buildSessionFactory(HibernateUtil.java:15)
... 3 more
My Test class :
import DAO.services;
import DAO.Produit;
public class test {
public static void main(String[] args) {
// TODO Auto-generated method stub
services s = new services();
Produit p = new Produit("PC","Sony Vaio",(double )7500);
s.addProduit(p);
}
}
Hibernate.cfg.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<!-- Generated file - Do not edit! -->
<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory>
<!-- User / Password -->
<property name="connection.username">root</property>
<property name="connection.password"></property>
<!-- Database Settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- for performance reasons changed to MyISAM from org.hibernate.dialect.MySQLInnoDBDialect -->
<property name="dialect">org.openmeetings.app.hibernate.utils.MySQL5MyISAMDialect</property>
<property name="connection.url">jdbc:mysql://localhost:3306/gestProd</property>
<property name="hibernate.connection.CharSet">utf8</property>
<property name="hibernate.connection.characterEncoding">utf8</property>
<property name="hibernate.connection.useUnicode">true</property>
<!-- Database Scheme Auto Update -->
<property name="hbm2ddl.auto">update</property>
<!-- properties -->
<property name="show_sql">true</property>
<property name="use_outer_join">false</property>
<property name="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</property>
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<!--
<property name="connection.provider_class ">org.hibernate.connection.C3P0ConnectionProvider</property>
-->
<property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.generate_statistics">false</property>
<property name="hibernate.cache.use_structured_entries">false</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.min_size">2</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.c3p0.timeout">100</property>
<!-- mapping files -->
<mapping resource="DAO/Categorie.hbm.xml"/>
<mapping resource="DAO/Produit.hbm.xml"/>
</session-factory>
</hibernate-configuration>
service.java :
package DAO;
import org.hibernate.Session;
import util.HibernateUtil;
public class services {
public void addProduit(Produit p){
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
session.save(p);
session.getTransaction().commit();
}
}
AND finally 2 classes for my objects ( Produit and Categorie ) and their Configuration files !
What do you think may be the source of this error ?
Thank you :)
The dialect for MySql with MyISAM(if that is what you have) should be:
org.hibernate.dialect.MySQLMyISAMDialect

Failed to create sessionFactory object.org.hibernate.MappingException: invalid configuration

Why do I get "Failed to create sessionFactory object.org.hibernate.MappingException: invalid configuration" when I try to execute the main? I'm using Hibernate 4.2.11.Final with a PostGreSQL DB. This is my hibernate.cfg.xml:
<?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.PostgreSQLDialect</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">postgres</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/ProgettoPersonaleDB</property>
<property name="connection_pool_size">1</property>
<property name="hbm2ddl.auto">create</property>
<property name="show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<!-- <mapping class="org.javabrains.sanjaya.dto.UserDetails" /> -->
<mapping resource="Players.hbm.xml" />
<mapping resource="Users.hbm.xml" />
<!-- <mapping class="ProgettoPersonale.src.main.java.ProgettoPersonale.ProgettoPersonale.Users.java"/> -->
<mapping
class="ProgettoPersonale/src/main/java/ProgettoPersonale/ProgettoPersonale/Users.java" />
/
<mapping
class="ProgettoPersonale/src/main/java/ProgettoPersonale/ProgettoPersonale/Players" />
<class-cache class="org.hibernate.auction.Item" usage="read-write"/>
<class-cache class="org.hibernate.auction.Bid" usage="read-only"/>
<collection-cache collection="org.hibernate.auction.Item.bids" usage="read-write"/>
</session-factory>
</hibernate-configuration>
And this is the full stack-trace, thank you!
02:02:35.149 [main] DEBUG o.h.i.util.xml.DTDEntityResolver - Located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
Failed to create sessionFactory object.org.hibernate.MappingException: invalid configuration
Exception in thread "main" java.lang.ExceptionInInitializerError
at ProgettoPersonale.ProgettoPersonale.ManagePlayers.addPlayer(ManagePlayers.java:27)
at ProgettoPersonale.ProgettoPersonale.PlayersMain.main(PlayersMain.java:23)
Caused by: org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2098)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2015)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1994)
at ProgettoPersonale.ProgettoPersonale.ManagePlayers.addPlayer(ManagePlayers.java:21)
... 1 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 36; columnNumber: 20; Il contenuto del tipo di elemento "session-factory" deve corrispondere a "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1994)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:879)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2095)
... 4 more
You had a extra / in the middle of the conf:
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">postgres</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/ProgettoPersonaleDB</property>
<property name="connection_pool_size">1</property>
<property name="hbm2ddl.auto">create</property>
<property name="show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<!-- <mapping class="org.javabrains.sanjaya.dto.UserDetails" /> -->
<mapping resource="Players.hbm.xml" />
<mapping resource="Users.hbm.xml" />
<!-- <mapping class="ProgettoPersonale.src.main.java.ProgettoPersonale.ProgettoPersonale.Users.java"/> -->
<mapping
class="ProgettoPersonale/src/main/java/ProgettoPersonale/ProgettoPersonale/Users.java" />
<mapping
class="ProgettoPersonale/src/main/java/ProgettoPersonale/ProgettoPersonale/Players" />
<class-cache class="org.hibernate.auction.Item" usage="read-write"/>
<class-cache class="org.hibernate.auction.Bid" usage="read-only"/>
<collection-cache collection="org.hibernate.auction.Item.bids" usage="read-write"/>
</session-factory>
It looks like there is an extra '/' on line 26 of the hibernate.cfg.xml. Remove that and try again.

After implementing C3P0 the page keeps refreshing

I am trying to implement C3P0 into my hibernate. I have as follows:
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<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://IPaddress</property>
<property name="hibernate.connection.username">user</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.current_session_context_class">thread</property>
<!-- JDBC connection pool (use the built-in) -->
<!--<property name="connection.pool_size">20</property>-->
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">1000</property>
<property name="hibernate.c3p0.max_size">10</property>
<property name="hibernate.c3p0.max_statements">10</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">864000</property>
<property name="hibernate.c3p0.idleConnectionTestPeriod">30</property>
<property name="hibernate.c3p0.initialPoolSize">10</property>
<property name="hibernate.c3p0.maxPoolSize">100</property>
<property name="hibernate.c3p0.minPoolSize">10</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Mappings -->
<mapping class="com.nebuilder.ats.pojo.TopicsDetails"/>
<mapping class="com.nebuilder.ats.pojo.GroupsDetails"/>
<mapping class="com.nebuilder.ats.pojo.ModulesDetails"/>
<mapping class="com.nebuilder.ats.pojo.TraineesDetails"/>
<mapping class="com.nebuilder.ats.pojo.ColoursDetails"/>
<mapping class="com.nebuilder.ats.pojo.CustomersDetails"/>
<mapping class="com.nebuilder.ats.dao.MusicStoreDaoImpl"/>
</session-factory>
</hibernate-configuration>
ApplicationContext.xml
<beans>
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
p:location="classpath:jdbc.properties"/>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="${jdbc.driverClassName}"
p:url="${jdbc.url}"
p:username="${jdbc.username}"
p:password="${jdbc.password}"
p:connectionProperties="${jdbc.connectionProperties}"/>
<!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
</beans>
Both of the files are in my resources folder. They seem to be working, but the problem is that my page keeps loading or refreshing without displaying any information when I try to access the database.
I am using jars as follow - hibernate-c3p0 3.6.3.Final, hibernate-core 3.6.3.Final, c3p0 0.9.1.2
Did you try to debug your application to see where is the problem ?
Moreover, it seems to be a little bit excessive to define a timeout of 864 000 ms, isn't it ?

how to solve Null user or password not supported in THIN driver

i am getting Null user or password not supported in THIN driver when configure jpa with hibernate configuration in seam
components.xml
<persistence:hibernate-session-factory name="hibernateSessionFactory" cfg-resource-name="hibernate.cfg.xml"/>
<persistence:managed-hibernate-session name="session"
auto-create="true"
session-factory-jndi-name="java:/mobeeSessionFactory"/>
hibernate.cfg.xml
<hibernate-configuration>
<session-factory name="java:/mobeeSessionFactory">
<property name="hibernate.connection.pool_size">10</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:#localhost:1521:mobee</property>
<property name="hibernate.connection.username">mobeemigrate</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.default_entity_mode">pojo</property>
<property name="hibernate.session_factory_name">java:/mobeeSessionFactory</property>
<property name="hibernate.connection.datasource">mobeeadminDataSource</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.auto_close_session">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="hibernate.transaction.flush_before_completion">true</property>
<property name="hibernate.hbm2ddl.auto">create</property>
<!-- Here are the mappings -->
<mapping class="tempCustomers" package="com.manam.mobee.persist.entity.TempCustomers"/>
<mapping class="tempAccounts" package="com.manam.mobee.persist.entity.TempAccounts"/>
</session-factory>
</hibernate-configuration>
projectname-ds.xml
<local-tx-datasource>
<jndi-name>mobeeadminDataSource</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:oracle:thin:#localhost:1521:mobee</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<user-name>mobeemigrate</user-name>
<password>mobeemigrate</password>
</local-tx-datasource>
The password is missing from hibernate.cfg.xml.
To fix include the following in your hibernate.cfg.xml file as shown below:
<property name="hibernate.connection.password">mobeemigrate</property>
hibernate.cfg.xml
<hibernate-configuration>
<session-factory name="java:/mobeeSessionFactory">
<property name="hibernate.connection.pool_size">10</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:#localhost:1521:mobee</property>
<property name="hibernate.connection.username">mobeemigrate</property>
<property name="hibernate.connection.password">mobeemigrate</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.default_entity_mode">pojo</property>
<property name="hibernate.session_factory_name">java:/mobeeSessionFactory</property>
<property name="hibernate.connection.datasource">mobeeadminDataSource</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.auto_close_session">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="hibernate.transaction.flush_before_completion">true</property>
<property name="hibernate.hbm2ddl.auto">create</property>
<!-- Here are the mappings -->
<mapping class="tempCustomers" package="com.manam.mobee.persist.entity.TempCustomers"/>
<mapping class="tempAccounts" package="com.manam.mobee.persist.entity.TempAccounts"/>
</session-factory>
</hibernate-configuration>
Your hibernate.cfg.xml has the following property:
<property name="hibernate.connection.username">mobeemigrate</property>
But not the corresponding password one:
<property name="hibernate.connection.password">mobeemigrate</property>

Categories

Resources