I did the following program:
Quote:
class Test{
public static void main(String[] args){
CD cd = new CD("Piero", "Morgana", new Date(), 12.99);
try{
Configuration cfg = new Configuration().addClass(CD.class);
SessionFactory sessionFactory = cfg.buildSessionFactory();
Session session = sessionFactory.openSession();
session.save(cd);
session.flush();
session.close();
} catch (Exception e){}
}
}
the error is this:
Quote:
log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environm
ent).
log4j:WARN Please initialize the log4j system properly.
I found a log4j.properties in the hibernate code and I put in my source code. the result is:
Quote:
C:\Documents and Settings\trattino\myapp>java Test
23:15:21,032 INFO Environment:432 - Hibernate 2.1 final
23:15:21,032 INFO Environment:466 - loaded properties from resource hibernate.p
roperties: {hibernate.connection.username=root, hibernate.connection.password=we
r, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hiber
nate.dialect.MySQLDialect, hibernate.show_sql=true, hibernate.connection.url=jdb
c:mysql://localhost/products, hibernate.connection.driver_class=com.mysql.jdbc.D
river}
23:15:21,048 INFO Environment:481 - using CGLIB reflection optimizer
23:15:21,048 INFO Configuration:305 - Mapping resource: CD.hbm.xml
23:15:21,376 INFO Binder:220 - Mapping class: CD -> cd
23:15:21,438 INFO Configuration:571 - processing one-to-many association mappin
gs
23:15:21,438 INFO Configuration:580 - processing one-to-one association propert
y references
23:15:21,438 INFO Configuration:605 - processing foreign key constraints
23:15:21,438 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.MySQLDia
lect
23:15:21,454 INFO SettingsFactory:62 - Use outer join fetching: true
23:15:21,454 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in
connection pool (not for production use!)
23:15:21,454 INFO DriverManagerConnectionProvider:42 - Hibernate connection poo
l size: 20
23:15:21,454 INFO DriverManagerConnectionProvider:71 - using driver: com.mysql.
jdbc.Driver at URL: jdbc:mysql://localhost/products
23:15:21,454 INFO DriverManagerConnectionProvider:72 - connection properties: {
user=root, password=wer}
23:15:21,454 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLoo
kup configured (in JTA environment, use of process level read-write cache is not
recommended)
23:15:21,657 INFO SettingsFactory:89 - Use scrollable result sets: true
23:15:21,657 INFO SettingsFactory:90 - JDBC 2 max batch size: 15
23:15:21,657 INFO SettingsFactory:96 - echoing all SQL to stdout
23:15:21,657 INFO SettingsFactory:99 - Query language substitutions: {}
23:15:21,657 INFO SettingsFactory:110 - cache provider: net.sf.ehcache.hibernat
e.Provider
23:15:21,657 INFO Configuration:1044 - instantiating and configuring caches
23:15:21,735 INFO SessionFactoryImpl:118 - building session factory
23:15:21,938 INFO SessionFactoryObjectFactory:82 - no JNDI name configured
What does it mean? the record that i would put hasn't been stored...