This is running on OJB RC 6, SDK 1.4.2. Something similar in RC 5 seems to work.
-----Original Message----- From: Fred McCann [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 01, 2004 3:53 PM To: OJB Users List Subject: PersistenceBrokerFactory.setDefaultKey I'm having a problem setting the default key for PersistenceBrokerFactory. I have 2 connections defined in repository.xml:: <jdbc-connection-descriptor jcd-alias="live" default-connection="true" platform="Hsqldb" jdbc-level="2.0" driver="org.hsqldb.jdbcDriver" ... </jdbc-connection-descriptor> <jdbc-connection-descriptor jcd-alias="development" default-connection="false" platform="Hsqldb" jdbc-level="2.0" driver="org.hsqldb.jdbcDriver" ... </jdbc-connection-descriptor> I'm trying to use the "development" connection descriptor in JUnit tests. I'm using this statement in the setup method: protected void setUp() throws Exception { super.setUp(); if ((PersistenceBrokerFactory.getDefaultKey() == null) || (!PersistenceBrokerFactory.getDefaultKey().getAlias().equals("development")) ) PersistenceBrokerFactory.setDefaultKey(new PBKey("development")); } This is not working in a big way: [junit] Testcase: testLogin took 1.219 sec [junit] Caused an ERROR [junit] Default key is already set. Current key is org.apache.ojb.broker.PBKey: jcdAlias=jake, user=sa, password=***** [junit] org.apache.ojb.broker.metadata.MetadataException: Default key is already set. Current key is org.apache.ojb.broker.PBKey: jcdAlias=live, user=sa, password=***** [junit] at org.apache.ojb.broker.metadata.MetadataManager.setDefaultPBKey(MetadataManag er.java:541) [junit] at org.apache.ojb.broker.PersistenceBrokerFactory.setDefaultKey(PersistenceBrok erFactory.java:49) [junit] at com.alloy.hipe.business.HipeTestCase.setUp(Unknown Source) [junit] at com.alloy.hipe.business.TestAccountLogic.setUp(Unknown Source) [junit] Testcase: testLogin Am I doing something obviously wrong? Is this the wrong way of going about this? Any feedback would be great. Thanks! - Fred McCann --------------------------------------------------------------------- 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]
