Griaß' eich,
ich hätte eine Frage zu auto=update! Ich habe in meinem JAVA Programm eine sehr komplizierte Objektstruktur und möchte die Tabellen in meiner MySQL Datenbank automatisch generieren lassen und NICHT selbstständig eingeben!
Meine bisherige Recherche hat ergeben, dass ich mit dem Befehl
<property name="hibernate.hbm2ddl.auto">update</property>
in meiner meiner hibernate.cfg.xml dieses Problem lössen kann.
Kann sein dass ich für diesen Zweck noch weitere Maßnahmen treffen muss?
Anbei meine Ausgabe:
12:54:00,812 INFO Version:15 - Hibernate Annotations 3.4.0.GA
12:54:00,828 INFO Environment:543 - Hibernate 3.3.0.SP1
12:54:00,828 INFO Environment:576 - hibernate.properties not found
12:54:00,859 INFO Environment:709 - Bytecode provider name : javassist
12:54:00,859 INFO Environment:627 - using JDK 1.4 java.sql.Timestamp handling
12:54:00,937 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
12:54:00,937 INFO Configuration:1460 - configuring from resource: /hibernate.cfg.xml
12:54:00,937 INFO Configuration:1437 - Configuration resource: /hibernate.cfg.xml
12:54:01,062 INFO Configuration:1575 - Configured SessionFactory: null
12:54:01,062 INFO HibernateSearchEventListenerRegister:53 - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
12:54:01,140 INFO AnnotationBinder:419 - Binding entity from annotated class: de.laliluna.example.Honey
12:54:01,187 INFO EntityBinder:422 - Bind entity de.laliluna.example.Honey on table Honey
12:54:01,234 INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
12:54:01,312 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
12:54:01,312 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 20
12:54:01,312 INFO DriverManagerConnectionProvider:68 - autocommit mode: false
12:54:01,328 INFO DriverManagerConnectionProvider:103 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/Test
12:54:01,328 INFO DriverManagerConnectionProvider:109 - connection properties: {user=root, password=****}
12:54:01,656 INFO SettingsFactory:116 - RDBMS: MySQL, version: 5.1.33-community
12:54:01,656 INFO SettingsFactory:117 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.7 ( Revision: ${svn.Revision} )
12:54:01,671 INFO Dialect:175 - Using dialect: org.hibernate.dialect.MySQLDialect
12:54:01,671 INFO TransactionFactoryFactory:62 - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
12:54:01,671 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
12:54:01,671 INFO SettingsFactory:170 - Automatic flush during beforeCompletion(): disabled
12:54:01,687 INFO SettingsFactory:174 - Automatic session close at end of transaction: disabled
12:54:01,687 INFO SettingsFactory:181 - JDBC batch size: 15
12:54:01,687 INFO SettingsFactory:184 - JDBC batch updates for versioned data: disabled
12:54:01,687 INFO SettingsFactory:189 - Scrollable result sets: enabled
12:54:01,687 INFO SettingsFactory:197 - JDBC3 getGeneratedKeys(): enabled
12:54:01,687 INFO SettingsFactory:205 - Connection release mode: auto
12:54:01,687 INFO SettingsFactory:229 - Maximum outer join fetch depth: 2
12:54:01,687 INFO SettingsFactory:232 - Default batch fetch size: 1
12:54:01,687 INFO SettingsFactory:236 - Generate SQL with comments: disabled
12:54:01,687 INFO SettingsFactory:240 - Order SQL updates by primary key: disabled
12:54:01,687 INFO SettingsFactory:244 - Order SQL inserts for batching: disabled
12:54:01,687 INFO SettingsFactory:420 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
12:54:01,687 INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory
12:54:01,687 INFO SettingsFactory:252 - Query language substitutions: {}
12:54:01,687 INFO SettingsFactory:257 - JPA-QL strict compliance: disabled
12:54:01,687 INFO SettingsFactory:262 - Second-level cache: enabled
12:54:01,687 INFO SettingsFactory:266 - Query cache: disabled
12:54:01,687 INFO SettingsFactory:405 - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
12:54:01,687 INFO SettingsFactory:276 - Optimize cache for minimal puts: disabled
12:54:01,687 INFO SettingsFactory:285 - Structured second-level cache entries: disabled
12:54:01,703 INFO SettingsFactory:305 - Echoing all SQL to stdout
12:54:01,703 INFO SettingsFactory:314 - Statistics: disabled
12:54:01,703 INFO SettingsFactory:318 - Deleted entity synthetic identifier rollback: disabled
12:54:01,703 INFO SettingsFactory:333 - Default entity-mode: pojo
12:54:01,703 INFO SettingsFactory:337 - Named query checking : enabled
12:54:01,750 INFO SessionFactoryImpl:187 - building session factory
12:54:01,984 INFO SessionFactoryObjectFactory:105 - Not binding factory to JNDI, no JNDI name configured
12:54:01,984 INFO SchemaUpdate:138 - Running hbm2ddl schema update
12:54:01,984 INFO SchemaUpdate:149 - fetching database metadata
12:54:01,984 INFO SchemaUpdate:161 - updating schema
12:54:02,218 INFO TableMetadata:62 - table found: Test.honey
12:54:02,218 INFO TableMetadata:63 - columns: [id, name, taste]
12:54:02,218 INFO TableMetadata:65 - foreign keys: []
12:54:02,218 INFO TableMetadata:66 - indexes: [primary]
12:54:02,218 INFO SchemaUpdate:183 - schema update complete
12:54:02,343 DEBUG SQL:111 - insert into Honey (name, taste) values (?, ?)
Hibernate: insert into Honey (name, taste) values (?, ?)
12:54:02,406 DEBUG SQL:111 - insert into Honey (name, taste) values (?, ?)
Hibernate: insert into Honey (name, taste) values (?, ?)
12:54:02,437 DEBUG TestExample:31 - Honey: 3 Name: forest honey Taste: very sweet
12:54:02,437 DEBUG TestExample:32 - Honey: 4 Name: country honey Taste: tasty
12:54:02,625 DEBUG SQL:111 - select honey0_.id as id0_, honey0_.name as name0_, honey0_.taste as taste0_ from Honey honey0_
Hibernate: select honey0_.id as id0_, honey0_.name as name0_, honey0_.taste as taste0_ from Honey honey0_
12:54:02,625 DEBUG TestExample:50 - Honey: 1 Name: Norther Forest Honey Taste: very sweet
12:54:02,625 DEBUG TestExample:50 - Honey: 3 Name: forest honey Taste: very sweet
12:54:02,625 DEBUG TestExample:50 - Honey: 4 Name: country honey Taste: tasty
12:54:02,640 DEBUG SQL:111 - delete from Honey where id=?
Hibernate: delete from Honey where id=?
12:54:02,703 DEBUG SQL:111 - select honey0_.id as id0_, honey0_.name as name0_, honey0_.taste as taste0_ from Honey honey0_
Hibernate: select honey0_.id as id0_, honey0_.name as name0_, honey0_.taste as taste0_ from Honey honey0_
12:54:02,703 DEBUG TestExample:50 - Honey: 1 Name: Norther Forest Honey Taste: very sweet
12:54:02,703 DEBUG TestExample:50 - Honey: 3 Name: forest honey Taste: very sweet
12:54:02,703 DEBUG SQL:111 - update Honey set name=?, taste=? where id=?
Hibernate: update Honey set name=?, taste=? where id=?
danke, glg Charlie
|