-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: CloudScape/Derby
PostPosted: Thu Sep 02, 2004 9:17 am 
Newbie

Joined: Fri Oct 24, 2003 2:59 pm
Posts: 6
Location: Swalmen, The Netherlands
Has anybody used the CloudScape database (soon to be known as Apache Derby)? We're currently using Hypersonic but we're running into size limitations that CloudScape claims not to have and as IBM is open-sourcing CloudScape we are assessing whether it is a viable alternative.

Should the Hibernate dialect be set to DB2?

Maurice.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 02, 2004 9:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I understand that they have rewritten cloudscape to match the dialect of DB2, so yes, that might be right. But I have not tested it, so you'll be the guinea pig ;-)

Are you sure the new version is actually released yet?


Top
 Profile  
 
 Post subject: Derby Site
PostPosted: Fri Sep 10, 2004 5:45 pm 
Newbie

Joined: Fri Sep 10, 2004 5:43 pm
Posts: 1
Location: Oakland, CA
http://incubator.apache.org/derby/index.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 10, 2004 10:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
....and there is no download there.


Top
 Profile  
 
 Post subject: I have a DerbyDialect working
PostPosted: Mon Sep 13, 2004 11:43 am 
Newbie

Joined: Mon Sep 13, 2004 11:33 am
Posts: 9
Location: Raleigh, NC
I have taken a post on jroller.com and built a Derby dialect that also fixes a problem with the difference between DB2 and Derby (Cloudscape 10b) generation of native IDs. Hopefully soon I can finish my testing and post the source - but how this gets into the standard distribution I don't know.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 12:47 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Post it to JIRA, thanks.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: derby.jar posted, with source
PostPosted: Mon Sep 13, 2004 1:32 pm 
Newbie

Joined: Mon Sep 13, 2004 11:33 am
Posts: 9
Location: Raleigh, NC
I have put together a jar with the source and binaries for the Derby dialect (IBM Cloudscape 10beta). I am not sure what "posting to JIRA" means (newbie - sorry). Anyway, I hope this is useful, I put the classes in the standard dialect namespace so they are easy to consume.

http://www.johnstonshome.org/~simon/pro ... /derby.jar


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 6:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Hibernate uses JIRA software for bug and feature tracking.
It is here http://opensource.atlassian.com/projects/hibernate/secure/Dashboard.jspa


Top
 Profile  
 
 Post subject: posted
PostPosted: Mon Sep 13, 2004 6:53 pm 
Newbie

Joined: Mon Sep 13, 2004 11:33 am
Posts: 9
Location: Raleigh, NC
OK, got it, I have posted a new patch to JIRA and attached both source classes.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 15, 2004 2:03 pm 
Newbie

Joined: Sat Sep 04, 2004 4:14 pm
Posts: 13
First, thanks Simon for putting the DerbyDialect together and posting it. I am in the process of integrating Cloudscape/Derby and Hibernate, so this was very timely for me. I have ran into some problems with it though. My first step was to use the CaveatEmptor 0.95 junit tests to see how it ran. It is much better then the DB2Dialect, but there are still errors in the tests. I have added a comment to the Jira issue where the patch was contributed, http://opensource.atlassian.com/projects/hibernate/browse/HB-1224 and have attached a copy of the junit test output.

As I noted there, my testing environment is exactly the same as Simons: Hibernate 2.1.6 and Cloudscape 10 beta.

I am quite interested in getting Hibernate and Cloudscape/Derby running together, so I am open to suggestions as to what I can do to help move this issue forward.

Also, please let my know if debug level Hibernate log excerpts and/or the generated SQL would be useful. It seemed like overkill to me in this instance.

- joel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 15, 2004 2:45 pm 
Newbie

Joined: Sat Sep 04, 2004 4:14 pm
Posts: 13
I have looked into the errors from the junit tests and it seems as if Cloudscase does not care for unique keys where one of the columns is nullable; in this case unique (NAME, PARENT_CATEGORY_ID)
caused the hicup. I got all of the tests to run successfully by removing PARENT_CATEGORY_ID from the unique key. I am not sure if this is a problem with Cloudscape or CaveatEmptor. If it is Cloudscape, which is what I suspect, what can be done about it? Should this be escalated to the Derby team with a test case?

There are also still reports of SQL errrors in the junit output, but these do not trigger test failures, so I assume that the testcases are swallowing them. They do, however, look worrysome to me. Advice would be appreciated.

Code:
19:27:33,875 ERROR SchemaExport: Unsuccessful: alter table BANK_ACCOUNT add constraint FK1_BANK_ACCOUNT_ID foreign key (BANK_ACCOUNT_ID) references BILLING_DETAILS
19:27:33,875 ERROR SchemaExport: DB2 SQL error: SQLCODE: -1, SQLSTATE: 42622, SQLERRMC: FK1_BANK_ACCOUNT_ID^T18^T42622
19:27:34,062 ERROR SchemaExport: Unsuccessful: alter table CATEGORY add constraint FK1_PARENT_CATEGORY_ID foreign key (PARENT_CATEGORY_ID) references CATEGORY
19:27:34,062 ERROR SchemaExport: DB2 SQL error: SQLCODE: -1, SQLSTATE: 42622, SQLERRMC: FK1_PARENT_CATEGORY_ID^T18^T42622
19:27:34,062 ERROR SchemaExport: Unsuccessful: alter table ITEM add constraint FK1_APPROVED_BY_USER_ID foreign key (APPROVED_BY_USER_ID) references USERS
19:27:34,062 ERROR SchemaExport: DB2 SQL error: SQLCODE: -1, SQLSTATE: 42622, SQLERRMC: FK1_APPROVED_BY_USER_ID^T18^T42622
19:27:34,171 ERROR SchemaExport: Unsuccessful: alter table ITEM add constraint FK3_SUCCESSFUL_BID_ID foreign key (SUCCESSFUL_BID_ID) references BID
19:27:34,171 ERROR SchemaExport: DB2 SQL error: SQLCODE: -1, SQLSTATE: 42622, SQLERRMC: FK3_SUCCESSFUL_BID_ID^T18^T42622
19:27:34,171 ERROR SchemaExport: Unsuccessful: alter table USERS add constraint FK1_DEFAULT_BILLING_DETAILS_ID foreign key (DEFAULT_BILLING_DETAILS_ID) references BILLING_DETAILS
19:27:34,171 ERROR SchemaExport: DB2 SQL error: SQLCODE: -1, SQLSTATE: 42622, SQLERRMC: FK1_DEFAULT_BILLING_DETAILS_ID^T18^T42622


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 11:02 am 
Newbie

Joined: Sat Sep 04, 2004 4:14 pm
Posts: 13
After figuring out how to turn on meaninful logging in Cloudscape, I have made progress with understanding some of the issues of intergrating Hibernate with Cloudscape.

1) I mentioned in a previous post that while running the Junit tests for CaveatEmptor there were SQL errors relating to not being able to add contraints for foriegn keys. It turns out the Cloudscape has an 18 character limit on foriegn key names. Once I renamed these the first schemaexport ran without failures.

2) The next problem was caused by the foriegn keys being in place. At the end of the first testcase, teardown tries to drop the database. This results in a number of failures similar to the one I have included below. This log output is from Cloudscape, oddly (and a bit misleading) these failures are not reported in the junit output. The key to my moving forward with this now is to figure out why the 'DROP CONSTRAINT' operation if failing. Is this Cloudscape's problem or Hibernate's problem. Is there a work around?

Code:
2004-09-16 13:49:24.703 GMT Thread[DRDAConnThread_3,5,db2j.daemons] (XID = 519), (SESSIONID = 3), (DATABASE = NSSimpleDB), (DRDAID = NF000001.GC10-1013308820815797460{13}), Failed Statement is: drop
table BILLING_DETAILS
ERROR X0Y25: Operation 'DROP CONSTRAINT' cannot be performed on object 'SQL040916024919120' because CONSTRAINT 'FK1_BANK_ACCT_ID' is dependent on that object.
  at com.ihost.cs.iapi.error.StandardException.newException(Unknown Source)
  at com.ihost.cs.iapi.sql.dictionary.ConstraintDescriptor.prepareToInvalidate(Unknown Source)
  at com.ibm.db2cs.bi.c.coreInvalidateFor(Unknown Source)
  at com.ibm.db2cs.bi.c.invalidateFor(Unknown Source)
  at com.ibm.db2cs.g.ax.dropAllConstraintDescriptors(Unknown Source)
  at com.ibm.db2cs.g.ax.executeConstantAction(Unknown Source)
  at com.ibm.db2cs.g.as.open(Unknown Source)
  at com.ibm.db2cs.x.m.execute(Unknown Source)
  at com.ibm.db2cs.m.i.executeStatement(Unknown Source)
  at com.ibm.db2cs.m.i.execute(Unknown Source)
  at com.ibm.db2cs.m.i.executeUpdate(Unknown Source)
  at com.ihost.cs.impl.drda.DRDAConnThread.parseEXCSQLIMM(Unknown Source)
  at com.ihost.cs.impl.drda.DRDAConnThread.processCommands(Unknown Source)
  at com.ihost.cs.impl.drda.DRDAConnThread.run(Unknown Source)
============= begin nested exception, level (1) ===========
ERROR X0Y25: Operation 'DROP CONSTRAINT' cannot be performed on object 'SQL040916024919120' because CONSTRAINT 'FK1_DEF_BIL_DET_ID' is dependent on that object.
  at com.ihost.cs.iapi.error.StandardException.newException(Unknown Source)
  at com.ihost.cs.iapi.sql.dictionary.ConstraintDescriptor.prepareToInvalidate(Unknown Source)
  at com.ibm.db2cs.bi.c.coreInvalidateFor(Unknown Source)
  at com.ibm.db2cs.bi.c.invalidateFor(Unknown Source)
  at com.ibm.db2cs.g.ax.dropAllConstraintDescriptors(Unknown Source)
  at com.ibm.db2cs.g.ax.executeConstantAction(Unknown Source)
  at com.ibm.db2cs.g.as.open(Unknown Source)
  at com.ibm.db2cs.x.m.execute(Unknown Source)
  at com.ibm.db2cs.m.i.executeStatement(Unknown Source)
  at com.ibm.db2cs.m.i.execute(Unknown Source)
  at com.ibm.db2cs.m.i.executeUpdate(Unknown Source)
  at com.ihost.cs.impl.drda.DRDAConnThread.parseEXCSQLIMM(Unknown Source)
  at com.ihost.cs.impl.drda.DRDAConnThread.processCommands(Unknown Source)
  at com.ihost.cs.impl.drda.DRDAConnThread.run(Unknown Source)
============= end nested exception, level (1) ===========


This, of course, leaves the test enviroment unstable and it is all down hill from here. The rest of the tests now have mulitudes of problems because the test data has not been cleaned up.

3) I also tried to set up Cloudscape as the database for Junit tests in Hibernate 2.1.6. The results were not very encouraging; in the end the test run exausted java memory and failed. It appears from the output, though, the the problems are similar to the ones that I am running into with the CaveatEmptor test. I will take this one step at a time.

Thanks,
Joel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 11:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
In DB2Dialect:

Code:
   public boolean dropConstraints() {
      return false;
   }


Perhaps you need to override that.

Otherwise, perhaps cloudscape needs "drop table .... cascade constraints". Look at some of the other dialects to see how this stuff is handled on various dbs.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 1:09 pm 
Newbie

Joined: Sat Sep 04, 2004 4:14 pm
Posts: 13
The Cloudscape Reference Manual states that:

Quote:
DROP TABLE statement
DROP TABLE removes the specified table.

Syntax:
DROP TABLE
table


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 17, 2004 4:49 am 
Newbie

Joined: Sat Sep 04, 2004 4:14 pm
Posts: 13
Sorry Gavin, I misunderstood what you where suggesting. I have added
Code:
public boolean dropConstraints() {
      return true;
}

to the DerbyDialect and now all of the junit tests in CaveatEmptor pass without problems.

In the Cloudscape log I am getting errors such as these:
Code:
Failed Statement is: alter table COMMENTS drop constraint FK3_ITEM_ID
ERROR 42Y55: 'ALTER TABLE' cannot be performed on 'COMMENTS' because it does not exist.

Failed Statement is: drop table COMMENTS
ERROR 42Y55: 'DROP TABLE' cannot be performed on 'COMMENTS' because it does not exist.


Can these be safely ignored or do need to further investigate the cascade behaviour?

What I plan on doing next is to run the Hibernate 2.1.6 junit tests against Cloudscape. Is it logical to assume that if all tests do not pass that the Cloudscape dialect needs further work? Is there an actual test suite that specifically validates a database for usage with Hibernate?

- joel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.