PersistenceUnitReader#determinePersistenceUnitRootUrl returns wrong root url on JBoss 5, causing no detection of entity beans [SPR-5784] #10454
Labels
type: enhancement
A general enhancement
Milestone
Antony Stubbs opened SPR-5784 and commented
I have a problem with jpa/spring/hiberante/jboss not detecting my entity beans. The following is what I tracked it down to. Let me know what you think. I'm a bit new with JPA so I might have missed something of course.
The JPA spec in section 2.6 defines the root of the persistence unit to be:
However, when I deploy onto jboss, this method returns:
vfszip:/Users/antonystubbs/Applications/jboss-5.0.1.GA/server/default/deploy/Web-marCom-1.0-SNAPSHOT/WEB-INF/lib/Backend-1.0-SNAPSHOT.jar/META-INF/persistence-spring.xml
instead of what I expected:
vfszip:/Users/antonystubbs/Applications/jboss-5.0.1.GA/server/default/deploy/Web-marCom-1.0-SNAPSHOT/WEB-INF/lib/Backend-1.0-SNAPSHOT.jar
I believe this to be because the URL originalURL = resource.getURL(); call in #determinePersistenceUnitRootUrl returns a url which is missing the jar file separator (!/) for some reason, even though the it is actually within a jar, within a war (same problem with exploded war).
As per the javadoc for ResourceUtils.extractJarFileURL(originalURL);, the behaviour is correct, in that "(which may point to a resource in a jar file or to a jar file itself)." which is what it ends up with, but I don't think this is spec compliant.?
I have attached the PersistenceUnitPostProcessor which I use to correctly point to the Backkend.jar, which allows hibernate to correctly automatically locate all my entity beans. Otherwise, it doesn't find any. Which is simply (and not very carefully):
Affects: 2.5.6
Attachments:
Issue Links:
The text was updated successfully, but these errors were encountered: