db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Claes <...@contactoffice.com>
Subject Re: jdo 1.0 + jdo 2.0
Date Sun, 26 Feb 2006 18:21:25 GMT
Hi Craig,

Here follows a sample of what could be a problematic situation. But 
maybe I'm missing something obvious.
We are trying to mix a JDO 1.0 implementation (FastObjects) with a JDO 
2.0 implementation (JPOX 1.1). The problem occurs at runtime on one of 
the 'makePersistent' call, depending on the included jdo jar (1.x or 2.0).

Luc

import java.util.Properties;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;

public class Test {
private void init() {
// Create the JPOX 1.1 PMF
Properties propertiesJPOX = new Properties();
 
propertiesJPOX.setProperty("javax.jdo.PersistenceManagerFactoryClass","org.jpox.PersistenceManagerFactoryImpl");
// Other properties...
PersistenceManagerFactory pmfJPOX = 
JDOHelper.getPersistenceManagerFactory(propertiesJPOX);

// Create the FastObjects PMF
Properties propertiesFastObjects = new Properties();
	 
propertiesFastObjects.setProperty("javax.jdo.PersistenceManagerFactoryClass","com.poet.jdo.PersistenceManagerFactories");
// Other properties...
PersistenceManagerFactory pmfFastObjects = 
JDOHelper.getPersistenceManagerFactory(propertiesFastObjects);

PersistenceManager pmJPOX = pmfJPOX.getPersistenceManager();
PersistenceManager pmFastObjects = pmfFastObjects.getPersistenceManager();
		
Object objectToMakePersistent = null;
// Here, various operations are taking place...
	
// This will fail at runtime if we import the 1.x jdo.jar
// because makePersistent is declared as returning void
pmJPOX.makePersistent(objectToMakePersistent);
		
// This will fail at runtime if we import the 2.0 jdo.jar
// because makePersistent is declared as returning Object
pmFastObjects.makePersistent(objectToMakePersistent);
}
}


Craig L Russell wrote:
> Hi Luc Claes,
> 
> JDO was designed to allow clean separation of application classes, so 
> that you could mix and match implementations.
> 
> But maybe a more specific example of what you are trying to accomplish 
> would help decide the issue.
> 
> Regards,
> 
> Craig


Mime
View raw message