IntelliJ Java IDE
The moose likes Object Relational Mapping and the fly likes Not able to insert data Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Not able to insert data" Watch "Not able to insert data" New topic
Author

Not able to insert data

Selva Varadhan
Greenhorn

Joined: Aug 20, 2005
Posts: 14
Hi,
I am getting fowllowing exception when i try to insert the data using hibernate

INFO: Named query checking : enabled
13 Aug, 2007 11:11:52 AM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
13 Aug, 2007 11:11:53 AM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Inserting Record
Hibernate: insert into CITY (CITY_NAME) values (?)
could not insert: [com.quanta.movie.domain.City]
13 Aug, 2007 11:11:53 AM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 1364, SQLState: HY000
13 Aug, 2007 11:11:53 AM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Field 'CITY_ID' doesn't have a default value


Model object



Please help me on this issue..
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 16624

What's your database that you are using? AUTO will use the default database way of generating IDs, so for instance, using MySQL which has primary Keys that auto increment their value when they receive and insert statement, versus Oracle which requires a Sequence table.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
 
subject: Not able to insert data
 
Threads others viewed
How to use MBean in HibernateAnnotation
Failed to obtain specified collection Help Me
Hibernate: Column not found. org.hibernate.exception.GenericJDBCException
ORA-02291: integrity constraint, can not find parent key
SQLGrammarException
MyEclipse, The Clear Choice