Currently, in JPAConfigurationTask the first line in createConfiguration() is
Code:
Map overrides=new HashMap();
It instantiates override properties but never initializes this HashMap.
So, there is no way for the ant task to control overrides. This is a problem if you want to change JPA behavior from outside the persistence.xml file (which is the purpose of overrides).
I think changing the above line to something like this should fix the problem:
Code:
Properties overrides= new Properties();
File propertyFile=getPropertyFile();
if (propertyFile!=null) {
try {
overrides.load(new FileInputStream (propertyFile) );
}
catch (FileNotFoundException e) {
throw new BuildException(propertyFile + " not found.",e);
}
catch (IOException e) {
throw new BuildException("Problem while loading " + propertyFile,e);
}
}
Then you could do something like this in your ant file:
Code:
<jpaconfiguration persistenceunit="..." propertyfile="..."/>
which is basically accepted already now except that propertyfile is ignored which it shouldn't.