RE: Problems with OJB in a servlet container
I have seen this first hand - if you have other XML parser versions that are loading in your JVM, it can and will often keep your repository from being properly parsed. In particular, I saw that it often would be unable to resolve the location of the repository.dtd, even when it was clearly in the classpath. Make sure nothing else is in your jre/lib/ext first, then make sure your parses versions match those released with OJB. -Rob -Original Message- From: Alexander Prozor [mailto:[EMAIL PROTECTED] Sent: Friday, June 20, 2003 6:14 AM To: OJB Users List Subject: Re: Problems with OJB in a servlet container Maybe you use xalan lib different from OJB original version? it can't parse URL to repository.xml file. OJB don't put XMLreader.parse method in try/catch block so you will not be able to see real situation in the log files :(. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Caching/store bug?
I'm using OJB 1.0rc3, and running into a rather vexing caching issue - I'm hoping someone else can shed some light on the issue. I'm executing the following code: CollectionItemService service = CollectionItemService.getInstance(); CollectionItem item = service.findById( collectionItemId ); item.setAssignedDC( 0 ); item.setState( CollectionItem.STATE_UNASSIGNED ); log.info(*** Collection item has ID + item.getId() ); log.info(*** Assigned DC is + item.getAssignedDC() ); service.clearCache(); service.store( item ); log.info(*** Collection item has ID + item.getId() ); log.info(*** Assigned DC is + item.getAssignedDC() ); and the service methods look like this: protected CollectionItemService() { broker = PersistenceBrokerFactory.defaultPersistenceBroker(); } public static CollectionItemService getInstance() { return new CollectionItemService(); } public void store( CollectionItem c ) { broker.beginTransaction(); broker.store( c ); broker.commitTransaction(); broker.close(); } public CollectionItem findById( String collectionItemId ) { Criteria crit = new Criteria(); crit.addEqualTo(id, collectionItemId); Query query = new QueryByCriteria( CollectionItem.class, crit ); return (CollectionItem) broker.getObjectByQuery( query ); } The debug statements before I call store output: *** Collection item has ID 1 *** Assigned DC is 0 and after store, the output is: *** Collection item has ID 1 *** Assigned DC is 1 (This was the value prior to setAssignedDC) I find it rather vexing that somehow, the broker.store() seems to be changing the state of the object I am storing. I see the parameterized update statement being properly generated by the SqlGenerator, but the database is also not being properly updated. Can anyone shed some light on this problem? -Rob