Hello group,
I have problem in executing the example code of hibernate-3.0 package. When i execute the example its creating the tables in the database but its not inserting any values and listing any data from the database. But in the console it is showing all the queries it executing like create quere, insert query and select query but at the end its giving error message that user id is not exist. ofcourse its not ther in the table. So why it is not inserting in to the table. I am pasting the message it displays in my console and i am not giving all my files since its a example code it is available in the package hibernate-3.0 in
www.hibernate.org.
###############################################
This is my console output.
###############################################
D:\hibernate-3.0>build eg
D:\hibernate-3.0>set JDBC_DRIVER=lib/jdbc.jar
D:\hibernate-3.0>java -cp "lib/ant-launcher-1.6.2.jar" org.apache.tools.ant.launch.Launcher -lib lib -Ddriver.jar=lib/jdbc.ja
r eg
Buildfile: build.xml
[taskdef] Could not load definitions from resource checkstyletask.properties. It could not be found.
[taskdef] Could not load definitions from resource clovertasks. It could not be found.
eg:
[javac] Compiling 1 source file to D:\hibernate-3.0\eg
[echo] remember to place your JDBC driver in the lib directory
[java] 11:10:17,627 INFO Environment:460 - Hibernate 3.0
[java] 11:10:17,643 INFO Environment:478 - loaded properties from resource hibernate.properties: {hibernate.connection.
username=hrdl , hibernate.connection.password=****, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=org.hi
bernate.dialect.OracleDialect, hibernate.connection.url=jdbc:oracle:thin:@server2:1521:oracle, hibernate.connection.driver_cl
ass=oracle.jdbc.driver.OracleDriver, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N'}
[java] 11:10:17,643 INFO Environment:506 - using CGLIB reflection optimizer
[java] 11:10:17,659 INFO Environment:536 - using JDK 1.4 java.sql.Timestamp handling
[java] 11:10:17,737 INFO Configuration:460 - Mapping resource: org/hibernate/auction/AuctionItem.hbm.xml
[java] 11:10:18,237 INFO HbmBinder:258 - Mapping class: org.hibernate.auction.AuctionItem -> AuctionItem
[java] 11:10:18,362 INFO Configuration:460 - Mapping resource: org/hibernate/auction/Bid.hbm.xml
[java] 11:10:18,424 INFO HbmBinder:258 - Mapping class: org.hibernate.auction.Bid -> Bid
[java] 11:10:18,487 INFO HbmBinder:736 - Mapping subclass: org.hibernate.auction.BuyNow -> Bid
[java] 11:10:18,487 INFO Configuration:460 - Mapping resource: org/hibernate/auction/User.hbm.xml
[java] 11:10:18,518 INFO HbmBinder:258 - Mapping class: org.hibernate.auction.User -> AuctionUser
[java] 11:10:18,534 INFO Configuration:851 - processing extends queue
[java] 11:10:18,534 INFO Configuration:855 - processing collection mappings
[java] 11:10:18,534 INFO HbmBinder:1953 - Mapping collection: org.hibernate.auction.AuctionItem.bids -> Bid
[java] 11:10:18,534 INFO HbmBinder:1953 - Mapping collection: org.hibernate.auction.User.bids -> Bid
[java] 11:10:18,549 INFO HbmBinder:1953 - Mapping collection: org.hibernate.auction.User.auctions -> AuctionItem
[java] 11:10:18,549 INFO Configuration:864 - processing association property references
[java] 11:10:18,549 INFO Configuration:893 - processing foreign key constraints
[java] 11:10:18,784 INFO Dialect:91 - Using dialect: org.hibernate.dialect.OracleDialect
[java] 11:10:18,799 INFO SettingsFactory:90 - Default batch fetch size: 1
[java] 11:10:18,799 INFO SettingsFactory:94 - Generate SQL with comments: disabled
[java] 11:10:18,799 INFO SettingsFactory:98 - Order SQL updates by primary key: disabled
[java] 11:10:18,799 INFO SettingsFactory:273 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[java] 11:10:18,799 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory
[java] 11:10:18,799 INFO SettingsFactory:106 - Query language substitutions: {no='N', true=1, yes='Y', false=0}
[java] 11:10:18,815 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for product
ion use!)
[java] 11:10:18,815 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
[java] 11:10:18,815 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
[java] 11:10:18,877 INFO DriverManagerConnectionProvider:80 - using driver: oracle.jdbc.driver.OracleDriver at URL: jdb
c:oracle:thin:@server2:1521:oracle
[java] 11:10:18,877 INFO DriverManagerConnectionProvider:86 - connection properties: {user=hrdl , password=****}
[java] 11:10:19,424 INFO SettingsFactory:148 - JDBC batch size: 15
[java] 11:10:19,424 INFO SettingsFactory:151 - JDBC batch updates for versioned data: disabled
[java] 11:10:19,424 INFO SettingsFactory:156 - Scrollable result sets: enabled
[java] 11:10:19,424 INFO SettingsFactory:164 - JDBC3 getGeneratedKeys(): disabled
[java] 11:10:19,424 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
[java] 11:10:19,440 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environmen
t, use of read-write or transactional second-level cache is not recommended)
[java] 11:10:19,440 INFO SettingsFactory:176 - Automatic flush during beforeCompletion(): disabled
[java] 11:10:19,440 INFO SettingsFactory:179 - Automatic session close at end of transaction: disabled
[java] 11:10:19,440 INFO SettingsFactory:260 - Cache provider: org.hibernate.cache.EhCacheProvider
[java] 11:10:19,440 INFO SettingsFactory:187 - Second-level cache: enabled
[java] 11:10:19,440 INFO SettingsFactory:192 - Optimize cache for minimal puts: disabled
[java] 11:10:19,456 INFO SettingsFactory:199 - Structured second-level cache entries: enabled
[java] 11:10:19,456 INFO SettingsFactory:203 - Query cache: disabled
[java] 11:10:19,456 INFO SettingsFactory:210 - Echoing all SQL to stdout
[java] 11:10:19,456 INFO SettingsFactory:214 - Statistics: disabled
[java] 11:10:19,456 INFO SettingsFactory:218 - Deleted entity synthetic identifier rollback: disabled
[java] 11:10:19,456 INFO SettingsFactory:232 - Default entity-mode: pojo
[java] 11:10:19,487 INFO SessionFactoryImpl:140 - building session factory
[java] 11:10:20,018 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
[java] 11:10:20,034 INFO Dialect:91 - Using dialect: org.hibernate.dialect.OracleDialect
[java] 11:10:20,034 INFO Configuration:851 - processing extends queue
[java] 11:10:20,034 INFO Configuration:855 - processing collection mappings
[java] 11:10:20,034 INFO Configuration:864 - processing association property references
[java] 11:10:20,034 INFO Configuration:893 - processing foreign key constraints
[java] 11:10:20,049 INFO Configuration:851 - processing extends queue
[java] 11:10:20,049 INFO Configuration:855 - processing collection mappings
[java] 11:10:20,049 INFO Configuration:864 - processing association property references
[java] 11:10:20,049 INFO Configuration:893 - processing foreign key constraints
[java] 11:10:20,049 INFO SchemaExport:114 - Running hbm2ddl schema export
[java] 11:10:20,049 INFO SchemaExport:130 - exporting generated schema to database
[java] 11:10:20,049 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for product
ion use!)
[java] 11:10:20,049 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
[java] 11:10:20,049 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
[java] 11:10:20,049 INFO DriverManagerConnectionProvider:80 - using driver: oracle.jdbc.driver.OracleDriver at URL: jdb
c:oracle:thin:@server2:1521:oracle
[java] 11:10:20,049 INFO DriverManagerConnectionProvider:86 - connection properties: {user=hrdl , password=****}
[java] 11:10:20,206 DEBUG SchemaExport:144 - drop table AuctionItem cascade constraints
[java] 11:10:20,284 DEBUG SchemaExport:144 - drop table AuctionUser cascade constraints
[java] 11:10:20,362 DEBUG SchemaExport:144 - drop table Bid cascade constraints
[java] 11:10:20,456 DEBUG SchemaExport:144 - drop sequence hibernate_sequence
[java] 11:10:20,471 DEBUG SchemaExport:162 - create table AuctionItem (
[java] id number(19,0) not null,
[java] description varchar2(255),
[java] ends date,
[java] condition number(10,0),
[java] seller number(19,0) not null,
[java] successfulBid number(19,0),
[java] primary key (id)
[java] )
[java] 11:10:20,581 DEBUG SchemaExport:162 - create table AuctionUser (id number(19,0) not null, userName varchar2(255)
not null, "password" varchar2(255), email varchar2(255), firstName varchar2(255), "initial" char(1), lastName varchar2(255),
primary key (id))
[java] 11:10:20,674 DEBUG SchemaExport:162 - create table Bid (id number(19,0) not null, isBuyNow char(1) not null, amou
nt float not null, "datetime" date not null, bidder number(19,0) not null, item number(19,0) not null, primary key (id))
[java] 11:10:20,784 DEBUG SchemaExport:162 - alter table AuctionItem add constraint FK522A9BD61107FE9B foreign key (sell
er) references AuctionUser
[java] 11:10:20,799 DEBUG SchemaExport:162 - alter table AuctionItem add constraint FK522A9BD6F65B1FAF foreign key (succ
essfulBid) references Bid
[java] 11:10:20,815 DEBUG SchemaExport:162 - alter table Bid add constraint FK104DDEE6E7E98 foreign key (item) reference
s AuctionItem
[java] 11:10:20,846 DEBUG SchemaExport:162 - alter table Bid add constraint FK104DDF43A3910 foreign key (bidder) referen
ces AuctionUser
[java] 11:10:20,877 DEBUG SchemaExport:162 - create sequence hibernate_sequence
[java] 11:10:20,877 INFO SchemaExport:174 - schema export complete
[java] 11:10:20,877 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:oracle:thin:@server2:1
521:oracle
[java] 11:10:20,893 INFO SessionFactoryImpl:366 - Checking 0 named queries
[java] Setting up some test data
[java] 11:10:20,909 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:oracle:thin:@server2:1
521:oracle
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&555555555555555555&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
[java] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
[java] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
[java] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
[java] Viewing all auction item objects
[java] Hibernate: select * from ( select auctionite0_.id as id0_, bids1_.id as id1_, user2_.id as id2_, auctionite0_.des
cription as descript2_0_0_, auctionite0_.ends as ends0_0_, auctionite0_.condition as condition0_0_, auctionite0_.seller as se
ller0_0_, auctionite0_.successfulBid as successf6_0_0_, bids1_.amount as amount1_1_, bids1_."datetime" as datetime1_1_, bids1
_.bidder as bidder1_1_, bids1_.item as item1_1_, bids1_.isBuyNow as isBuyNow1_, bids1_.item as item__, bids1_.id as id__, use
r2_.userName as userName2_2_, user2_."password" as password2_2_, user2_.email as email2_2_, user2_.firstName as firstName2_2_
, user2_."initial" as initial2_2_, user2_.lastName as lastName2_2_ from AuctionItem auctionite0_, Bid bids1_, AuctionUser use
r2_ where (auctionite0_.id=bids1_.item(+) and bids1_.bidder=user2_.id(+)) order by auctionite0_.ends desc ) where rownum <=
?
[java] Viewing all auction item info
[java] Hibernate: select * from ( select auctionite0_.id as col_0_0_, auctionite0_.description as col_1_0_, auctionite0_
.ends as col_2_0_, max(bids1_.amount) as col_3_0_ from AuctionItem auctionite0_, Bid bids1_ where auctionite0_.id=bids1_.item
(+) group by auctionite0_.id , auctionite0_.description , auctionite0_.ends order by auctionite0_.ends desc ) where rownum
<= ?
[java] Creating a new bid for auction item: null by user: 3
[java] Viewing all auction item info
[java] Hibernate: select * from ( select auctionite0_.id as col_0_0_, auctionite0_.description as col_1_0_, auctionite0_
.ends as col_2_0_, max(bids1_.amount) as col_3_0_ from AuctionItem auctionite0_, Bid bids1_ where auctionite0_.id=bids1_.item
(+) group by auctionite0_.id , auctionite0_.description , auctionite0_.ends order by auctionite0_.ends desc ) where rownum
<= ?
[java] Viewing user and auctions: 1
[java] Hibernate: select this_.id as id1_, this_.userName as userName2_1_, this_."password" as password2_1_, this_.email
as email2_1_, this_.firstName as firstName2_1_, this_."initial" as initial2_1_, this_.lastName as lastName2_1_, auctions2_.s
eller as seller__, auctions2_.id as id__, auctions2_.id as id0_, auctions2_.description as descript2_0_0_, auctions2_.ends as
ends0_0_, auctions2_.condition as condition0_0_, auctions2_.seller as seller0_0_, auctions2_.successfulBid as successf6_0_0_
from AuctionUser this_, AuctionItem auctions2_ where this_.id=auctions2_.seller(+) and this_.id=?
[java] Exception in thread "main" java.lang.IllegalArgumentException: No user for the given id: 1
[java] at org.hibernate.auction.Main.viewUserAuctions(Main.java:217)
[java] at org.hibernate.auction.Main.main(Main.java:383)BUILD FAILED
D:\hibernate-3.0\build.xml:620: Java returned: 1
Total time: 7 seconds
##############################################################################################
Please do reply with the solution for this problem. It will be very useful to me.
With Thanks and Regards