-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: hibernate.cfg.xml not found
PostPosted: Tue Feb 14, 2006 9:16 pm 
Beginner
Beginner

Joined: Tue Feb 07, 2006 10:39 pm
Posts: 46
i have tried the tutorial on http://www.roseindia.net/hibernate/runningexample.shtml

when i try to run the java application on FirstExample, the error shown as below:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
/hibernate.cfg.xml not found
java.lang.NullPointerException
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:36)
Exception in thread "main"

can anyone help?? thanx


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 10:11 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Have you written an hibernate.cfg.xml? If you have, make sure it's in the root directory of your classpath. If you're using ant, maven, eclipse or whatever to do your builds, ensure that the file is copied from the root of your src path to the root of your bin path.

If you haven't written one, you'll have to. The instructions are at the beginning of the ref docs.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 11:34 pm 
Beginner
Beginner

Joined: Tue Feb 07, 2006 10:39 pm
Posts: 46
i have written the hibernate.cfg.xml and placed in the root directory and also in the bin directory. the same still exist and just can't figure out why this can happen. can anyone help??


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 12:17 am 
Beginner
Beginner

Joined: Tue Feb 14, 2006 12:49 pm
Posts: 21
Location: Washington State
The lines
Quote:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.

indicate that you don't have the log4j.properties file in your classpath. I would suggest that you get that to work, then put the hibernate.cfg.xml in the same directory. The log4j.properties file is in the etc folder of the Hibernate 3.1 distribution.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 1:50 am 
Beginner
Beginner

Joined: Tue Feb 07, 2006 10:39 pm
Posts: 46
i had loaded the log4j.properties file in my project but still cant work out. the same errors are displayed. so how??


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 4:50 am 
Newbie

Joined: Tue Jan 31, 2006 2:30 am
Posts: 12
What is your directory structure?
Do you have a src directory? If you have one, put the hibernate.cfg.xml file there and also the log4j.properties

_________________
When all else fails - fresh tactics!


Top
 Profile  
 
 Post subject: finding where to put the log4j.properties file
PostPosted: Wed Feb 15, 2006 1:00 pm 
Beginner
Beginner

Joined: Tue Feb 14, 2006 12:49 pm
Posts: 21
Location: Washington State
What IDE are you using? I'm using Eclipse and have my source files and my class files separated. In my case the log4j.properties file goes in my bin directory while my classes go in a directory below that indicated by the package. So in a hello world example with the package named hello, my bin directory contains log4j.properties and a directory named hello which contains the class files. So the directory structure looks like:

Code:
HelloProject
    bin
        hello
            hi.class
        log4j.properties
    src
        hello
            hi.java

You should be able to decipher where to put yours by looking at where your class files end up. Your hibernate.properties file should be in the same directory. Since you are trying to use a hibernate.cfg.xml file, I believe that it goes there too, but I'm new to hibernate and having trouble getting it to accept parameters from either a properties file or an xml file, I can't tell you for sure. I have used log4j a lot. Once you get log4j working, you will be able to see it it's reading your properties or xml file.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 5:24 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Also, you could doublecheck that you're not using one of the versions of Configuration.configure() that looks in other places for the file. If you're using the 0-param version, then it will look in the root of your bin tree (or the top-level dir of any of your classpath dirs); otherwise it will look where you tell it. Also note that Configuration.configure("hibernate.cfg.xml") is not the same as Configuration.configure("/hibernate.cfg.xml"); you probably want to stick with plain old Configuration.configure() and follow the directions in this thread.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 10:20 pm 
Beginner
Beginner

Joined: Tue Feb 07, 2006 10:39 pm
Posts: 46
my recent stack trace is :

Feb 16, 2006 10:24:19 AM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.5
Feb 16, 2006 10:24:19 AM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Feb 16, 2006 10:24:19 AM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Feb 16, 2006 10:24:19 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Feb 16, 2006 10:24:19 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Feb 16, 2006 10:24:19 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Feb 16, 2006 10:24:19 AM org.hibernate.cfg.Configuration getConfigurationInputStream
WARNING: /hibernate.cfg.xml not found
/hibernate.cfg.xml not found
java.lang.NullPointerException
at test.firstName.main(firstName.java:39)
Exception in thread "main"


i have put the hibernate.cfg.xml and firstName.java in the same package and also into the bin directory.
i'm using eclipse wtp1.0 and hibernate 3.1.
my firstName.java file is as shown below:

package test;

import hibernate.ThreadLocalSession;
import model.User;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class firstName {

/*
* Hibernate example to inset data into User table
*/
public static void main(String[] args) {
Session ses = null;

try{
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
ses =sessionFactory.openSession();

//ses = ThreadLocalSession.currentSession();
//Create new instance of User and set values in it by reading them from form object
System.out.println("Inserting Record");
User user = new User();
user.setEmpNo("002");
user.setFirstName("Hii");
user.setLastName("Ling");
user.setDesignation("null");
user.setCompany("Shin Yang Sdn Bhd");
user.setDepartment("mis");
user.setExtNo("375");
ses.save(user);
System.out.println("Done");
}catch(Exception e){
System.out.println(e.getMessage());
}finally{
// Actual user insertion will happen at this step
ses.flush();
ses.close();

}

}
}


i really ran out of idea. can anyone help me??? thanx a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 10:52 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
hibernate.cfg.xml must be in the directory ABOVE the test package: it's in the / package, firstName is in the test package.

There's also a code bug that's causing the NullPointerException. You have this sequence of code (non-buggy code deleted):
Code:
Session ses = null;
try {
  SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
  ses = sessionFactory.openSession();
...
}
finally {
  ses.flush();
  ses.close();
}

So when the first line bugs out, so does your finally block, because ses is still null. Put a "if (ses != null) { ... }" around ses.close(). Also move ses.flush into the try block, because you mustn't use hibernate sessions after they've thrown exceptions.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 11:12 pm 
Beginner
Beginner

Joined: Tue Feb 07, 2006 10:39 pm
Posts: 46
after i have modified firstName.java to this:

package test;

import hibernate.ThreadLocalSession;
import model.User;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class firstName {

/*
* Hibernate example to inset data into User table
*/
public static void main(String[] args) {
Session ses = null;

try{
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
ses =sessionFactory.openSession();

//ses = ThreadLocalSession.currentSession();
//Create new instance of User and set values in it by reading them from form object
System.out.println("Inserting Record");
User user = new User();
user.setEmpNo("002");
user.setFirstName("Hii");
user.setLastName("Ling");
user.setDesignation("null");
user.setCompany("Shin Yang Sdn Bhd");
user.setDepartment("mis");
user.setExtNo("375");
ses.save(user);
System.out.println("Done");
ses.flush();
}catch(Exception e){
System.out.println(e.getMessage());
}

}
}

the error stack shown as below:

Feb 16, 2006 11:15:33 AM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.5
Feb 16, 2006 11:15:33 AM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Feb 16, 2006 11:15:33 AM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Feb 16, 2006 11:15:33 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Feb 16, 2006 11:15:34 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Feb 16, 2006 11:15:34 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Feb 16, 2006 11:15:34 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/User.hbm.xml
java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
at org.hibernate.mapping.Table.<init>(Table.java:32)
at org.hibernate.cfg.Mappings.addTable(Mappings.java:120)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:251)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
at org.hibernate.cfg.Configuration.add(Configuration.java:362)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:449)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
at test.firstName.main(firstName.java:19)
Exception in thread "main"


what can i do again? :( :(


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 11:20 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
You're still not finding the .cfg.xml file, did you move it to the directory ABOVE firstName.class?

To resolve your exception, put the apache commons-collections jar on your classpath.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 11:41 pm 
Beginner
Beginner

Joined: Tue Feb 07, 2006 10:39 pm
Posts: 46
i think hibernate.cfg.xml has been found as i did wat have told. thanx.
but the error stack shown again as below:

Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.5
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/User.hbm.xml
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.User -> USER
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Service.hbm.xml
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Service -> SERVICE
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Authorizer.hbm.xml
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Authorizer -> AUTHORIZER
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Company.hbm.xml
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Company -> COMPANY
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/ServiceType.hbm.xml
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.ServiceType -> SERVICE_TYPE
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: model.User.userInfo -> SERVICE
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: model.Service.serviceInfo -> AUTHORIZER
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
Feb 16, 2006 11:43:16 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Feb 16, 2006 11:43:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Feb 16, 2006 11:43:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 10
Feb 16, 2006 11:43:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Feb 16, 2006 11:43:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/symis
Feb 16, 2006 11:43:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=user, password=****}
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 4.1.13-nt
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.11 ( $Date: 2005-09-21 18:20:03 +0000 (Wed, 21 Sep 2005) $, $Revision: 4287 $ )
Feb 16, 2006 11:43:18 AM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
Feb 16, 2006 11:43:18 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
Feb 16, 2006 11:43:18 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: null
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Feb 16, 2006 11:43:18 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Feb 16, 2006 11:43:18 AM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1618)
at java.lang.Class.getConstructor0(Class.java:1930)
at java.lang.Class.newInstance0(Class.java:278)
at java.lang.Class.newInstance(Class.java:261)
at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:323)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:219)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
at test.firstName.main(firstName.java:19)
Exception in thread "main"


what is this 'net/sf/ehcache/CacheException' again? i have placed hibernate2.jar n hibernate3.jar in my build path.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 11:46 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
You don't want hib2 and hib3.. remove the one you aren't using.
You also need the ehcahce jar. If you don't have it lying around somewhere (does it come in the hibernate download?), you'll need to download it. Sourceforge is down at the moment, so you can't download it from there, but you should be able to find it with google or something.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 9:06 pm 
Beginner
Beginner

Joined: Tue Feb 07, 2006 10:39 pm
Posts: 46
i have tested my firstName.java successfully. but when i test testErvice.java, the output and errors as below shown:

Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.5
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/User.hbm.xml
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.User -> USER
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Service.hbm.xml
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Service -> SERVICE
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Authorizer.hbm.xml
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Authorizer -> AUTHORIZER
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/Company.hbm.xml
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.Company -> COMPANY
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: model/ServiceType.hbm.xml
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: model.ServiceType -> SERVICE_TYPE
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: model.User.userInfo -> SERVICE
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: model.Service.serviceInfo -> AUTHORIZER
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
Feb 17, 2006 9:00:16 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Feb 17, 2006 9:00:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Feb 17, 2006 9:00:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 10
Feb 17, 2006 9:00:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Feb 17, 2006 9:00:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/symis
Feb 17, 2006 9:00:16 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=user, password=****}
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 4.1.13-nt
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.11 ( $Date: 2005-09-21 18:20:03 +0000 (Wed, 21 Sep 2005) $, $Revision: 4287 $ )
Feb 17, 2006 9:00:17 AM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
Feb 17, 2006 9:00:17 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
Feb 17, 2006 9:00:17 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: null
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Feb 17, 2006 9:00:17 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Feb 17, 2006 9:00:17 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Feb 17, 2006 9:00:17 AM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Feb 17, 2006 9:00:17 AM net.sf.ehcache.config.Configurator configure
WARNING: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/eclipse/plugins/hibernate-2.1/lib/ehcache-0.9.jar!/ehcache-failsafe.xml
Feb 17, 2006 9:00:18 AM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Feb 17, 2006 9:00:18 AM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
Feb 17, 2006 9:00:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Feb 17, 2006 9:00:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 10
Feb 17, 2006 9:00:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Feb 17, 2006 9:00:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/symis
Feb 17, 2006 9:00:18 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=user, password=****}
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: Running hbm2ddl schema update
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: fetching database metadata
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: updating schema
Feb 17, 2006 9:00:18 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
Feb 17, 2006 9:00:18 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
Feb 17, 2006 9:00:18 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
Feb 17, 2006 9:00:18 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: symis.authorizer
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [service_id, autho_id, date, roles, service_info, name, autho_remarks]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk2_service_id, fkc376e1a9b61c9705]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [primary, service_id, fk2_service_id]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: symis.company
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [address2, tel_no, address3, address1, fax, name, company_id]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: []
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [primary]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: symis.service
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [require_date, service, emp_no, issue_date, service_id, service_remarks, user_info, state]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: [fk1_emp_no, fka10f52957a2140b8]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [emp_no, primary, fk1_emp_no]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: symis.service_type
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [service_type_id, description]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: []
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [primary]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: table found: symis.user
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: columns: [emp_no, designation, ext_no, last_name, first_name, department, company]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: foreign keys: []
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: indexes: [primary]
Feb 17, 2006 9:00:18 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: schema update complete
Feb 17, 2006 9:00:18 AM org.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:mysql://localhost/symis
Feb 17, 2006 9:00:18 AM org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 0 named queries
Inserting Record

not-null property references a null or transient value: model.Service.empNoorg.hibernate.PropertyValueException: not-null property references a null or transient value: model.Service.empNo
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:164)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at test.testService.main(testService.java:39)
Exception in thread "main"


my service.hbm.xml is as shown below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="model.Service"
table="SERVICE"
>

<id
name="serviceId"
column="SERVICE_ID"
type="java.lang.String"
>
<generator class="assigned">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Service.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<property
name="requireDate"
type="date"
update="true"
insert="true"
>
<column
name="REQUIRE_DATE"
/>
</property>

<property
name="issueDate"
type="date"
update="true"
insert="true"
>
<column
name="ISSUE_DATE"
/>
</property>

<many-to-one
name="empNo"
class="model.User"
cascade="none"
lazy="false"
update="true"
insert="true"
foreign-key="FK1_EMP_NO"
column="EMP_NO"
not-null="true"
/>

<property
name="sv_userInfo"
type="string"
update="true"
insert="true"
>
<column
name="USER_INFO"
/>

</property>

<property
name="state"
type="int"
update="true"
insert="true"
>
<column
name="STATE"
/>
</property>

<property
name="serviceRemarks"
type="string"
update="true"
insert="true"
>
<column
name="SERVICE_REMARKS"
/>
</property>

<property
name="service"
type="string"
update="true"
insert="true"
>
<column
name="SERVICE"
/>
</property>

<list
name="serviceInfo"
lazy="false"
inverse="true"
cascade="none"
>

<key
column="SERVICE_ID"
>
</key>

<index
column="SERVICE_INFO"
type="string"
/>

<one-to-many
class="model.Authorizer"
/>

</list>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Service.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>


can anyone comment about this? thanks in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.