Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Problem with inserting data.

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't persist the entity. Also it is Employee.
 
Dawid Skrzypczynski
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where do you persist the entity alex?
 
Dawid Skrzypczynski
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


very stupid mistake...

Thanks.
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic