wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Problem with inserting data. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem with inserting data." Watch "Problem with inserting data." New topic
Author

Problem with inserting data.

Dawid Skrzypczynski
Ranch Hand

Joined: Jun 08, 2011
Posts: 52
Hi,
I have database: "xxx" and i want to created new schema and insert it my object. My simple code create this schema but don't save object.

Config file:


class code:


Run code:


Console:
12:51:38,390 INFO Version:15 - Hibernate Annotations 3.4.0.GA
12:51:38,437 INFO Environment:560 - Hibernate 3.3.2.GA
12:51:38,437 INFO Environment:593 - hibernate.properties not found
12:51:38,437 INFO Environment:771 - Bytecode provider name : javassist
12:51:38,453 INFO Environment:652 - using JDK 1.4 java.sql.Timestamp handling
12:51:39,000 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
12:51:39,031 INFO Configuration:1474 - configuring from resource: hibernate.cfg.xml
12:51:39,031 INFO Configuration:1451 - Configuration resource: hibernate.cfg.xml
12:51:39,187 INFO Configuration:1589 - Configured SessionFactory: null
12:51:39,250 INFO Dialect:175 - Using dialect: org.hibernate.dialect.PostgreSQLDialect
12:51:39,453 INFO AnnotationBinder:419 - Binding entity from annotated class: com.hibernate.chapter1.Employe
12:51:39,546 INFO EntityBinder:422 - Bind entity com.hibernate.chapter1.Employe on table Employe
12:51:39,671 INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
12:51:39,781 INFO SchemaExport:226 - Running hbm2ddl schema export
12:51:39,796 DEBUG SchemaExport:242 - import file not found: /import.sql
12:51:39,796 INFO SchemaExport:251 - exporting generated schema to database
12:51:39,796 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
12:51:39,796 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 2
12:51:39,796 INFO DriverManagerConnectionProvider:68 - autocommit mode: false
12:51:39,812 INFO DriverManagerConnectionProvider:103 - using driver: org.postgresql.Driver at URL: jdbc:postgresql:postgres
12:51:39,812 INFO DriverManagerConnectionProvider:109 - connection properties: {user=postgres, password=****}
drop table xxx.Employe
12:51:40,000 DEBUG SchemaExport:377 - drop table xxx.Employe
12:51:40,000 DEBUG SchemaExport:362 - Unsuccessful: drop table xxx.Employe
12:51:40,000 DEBUG SchemaExport:363 - ERROR: table "employe" does not exist
create table xxx.Employe (empId int4 not null, empName varchar(255), primary key (empId))
12:51:40,000 DEBUG SchemaExport:377 - create table xxx.Employe (empId int4 not null, empName varchar(255), primary key (empId))
12:51:40,046 INFO SchemaExport:268 - schema export complete
12:51:40,046 INFO DriverManagerConnectionProvider:170 - cleaning up connection pool: jdbc:postgresql:postgres
12:51:40,062 INFO HibernateSearchEventListenerRegister:53 - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
12:51:40,062 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
12:51:40,062 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 2
12:51:40,062 INFO DriverManagerConnectionProvider:68 - autocommit mode: false
12:51:40,062 INFO DriverManagerConnectionProvider:103 - using driver: org.postgresql.Driver at URL: jdbc:postgresql:postgres
12:51:40,062 INFO DriverManagerConnectionProvider:109 - connection properties: {user=postgres, password=****}
12:51:40,125 INFO SettingsFactory:114 - RDBMS: PostgreSQL, version: 9.1beta3
12:51:40,125 INFO SettingsFactory:115 - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 9.1devel JDBC4 (build 900)
12:51:40,156 INFO Dialect:175 - Using dialect: org.hibernate.dialect.PostgreSQLDialect
12:51:40,156 INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions)
12:51:40,156 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
12:51:40,156 INFO SettingsFactory:161 - Automatic flush during beforeCompletion(): disabled
12:51:40,156 INFO SettingsFactory:165 - Automatic session close at end of transaction: disabled
12:51:40,156 INFO SettingsFactory:172 - JDBC batch size: 15
12:51:40,156 INFO SettingsFactory:175 - JDBC batch updates for versioned data: disabled
12:51:40,171 INFO SettingsFactory:180 - Scrollable result sets: enabled
12:51:40,171 INFO SettingsFactory:188 - JDBC3 getGeneratedKeys(): enabled
12:51:40,171 INFO SettingsFactory:196 - Connection release mode: auto
12:51:40,171 INFO SettingsFactory:214 - Default schema: xxx
12:51:40,171 INFO SettingsFactory:223 - Default batch fetch size: 1
12:51:40,171 INFO SettingsFactory:227 - Generate SQL with comments: disabled
12:51:40,171 INFO SettingsFactory:231 - Order SQL updates by primary key: disabled
12:51:40,171 INFO SettingsFactory:235 - Order SQL inserts for batching: disabled
12:51:40,171 INFO SettingsFactory:397 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
12:51:40,171 INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory
12:51:40,171 INFO SettingsFactory:243 - Query language substitutions: {}
12:51:40,171 INFO SettingsFactory:248 - JPA-QL strict compliance: disabled
12:51:40,171 INFO SettingsFactory:253 - Second-level cache: enabled
12:51:40,171 INFO SettingsFactory:257 - Query cache: disabled
12:51:40,187 INFO SettingsFactory:382 - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
12:51:40,187 INFO RegionFactoryCacheProviderBridge:61 - Cache provider: org.hibernate.cache.NoCacheProvider
12:51:40,187 INFO SettingsFactory:267 - Optimize cache for minimal puts: disabled
12:51:40,187 INFO SettingsFactory:276 - Structured second-level cache entries: disabled
12:51:40,203 INFO SettingsFactory:296 - Echoing all SQL to stdout
12:51:40,203 INFO SettingsFactory:305 - Statistics: disabled
12:51:40,203 INFO SettingsFactory:309 - Deleted entity synthetic identifier rollback: disabled
12:51:40,203 INFO SettingsFactory:324 - Default entity-mode: pojo
12:51:40,203 INFO SettingsFactory:328 - Named query checking : enabled
12:51:40,296 INFO SessionFactoryImpl:193 - building session factory
12:51:40,343 INFO DriverManagerConnectionProvider:170 - cleaning up connection pool: jdbc:postgresql:postgres
12:51:40,703 INFO SessionFactoryObjectFactory:105 - Not binding factory to JNDI, no JNDI name configured
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

You don't persist the entity. Also it is Employee.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Dawid Skrzypczynski
Ranch Hand

Joined: Jun 08, 2011
Posts: 52
I do like this guy:
http://www.youtube.com/watch?v=fURXIkP7pWA&feature=related

but this code only create schema. I don't know why don't insert data.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Where do you persist the entity alex?
Dawid Skrzypczynski
Ranch Hand

Joined: Jun 08, 2011
Posts: 52


very stupid mistake...

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with inserting data.
 
Similar Threads
org.hibernate.exception.SQLGrammarException: could not insert:
Hibernate newbie - Data sequence
org.hibernate.MappingException: entity class not found:
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@127.0.0.1:1521:XE
MySQLSyntaxErrorException: Access denied