private PBKey buildDefaultKey ( ) { List descriptors = connectionRepository ( ) . getAllDescriptor ( ) ; JdbcConnectionDescriptor descriptor ; PBKey result = null ; for ( Iterator iterator = descriptors . iterator ( ) ; iterator . hasNext ( ) ; ) { descriptor = ( JdbcConnectionDescriptor ) iterator . next ( ) ; if ( descriptor . isDefaultConnection ( ) ) { if ( result != null ) { log . error ( "Found additional connection descriptor with enabled 'default-connection' " + descriptor . getPBKey ( ) + ". This is NOT allowed. Will use the first found descriptor " + result + " as default connection" ) ; } else { result = descriptor . getPBKey ( ) ; } } } if ( result == null ) { log . info ( "No 'default-connection' attribute set in jdbc-connection-descriptors," + " thus it's currently not possible to use 'defaultPersistenceBroker()' " + " convenience method to lookup PersistenceBroker instances. But it's possible" + " to enable this at runtime using 'setDefaultKey' method." ) ; } return result ; }
Try to build an default PBKey for convenience PB create method .