[hibernate-dev] The PAR archive test case validity - PackagedEntityManagerTest

Steve Ebersole steve at hibernate.org
Thu Mar 10 07:18:09 EST 2016


I dislike having to instantiate File just to check.  Please leave the
pre-emptive "/" check before instantiating the File.



On Thu, Mar 10, 2016 at 4:16 AM Emmanuel Bernard <emmanuel at hibernate.org>
wrote:

> Right exactly. We ended up requiring persistence.xml and realized that
> not having a specific extension was not hurting performance and
> feasibility.
>
> On Wed 2016-03-09 22:49, Steve Ebersole wrote:
> > A PAR is just an archive with a META-INF/persistence.xml file in it.  The
> > JPA spec does cover this.  The extension is irrelevant.
> >
> > On Wed, Mar 9, 2016 at 4:08 PM Sanne Grinovero <sanne at hibernate.org>
> wrote:
> >
> > > I remember JBoss had "HAR" deployments to package Hibernate models and
> > > PU definitions.. as far as I know this was a JBoss only thing, it
> > > wouldn't surprise me if other app servers experimented with similar
> > > non-standardized archives.
> > >
> > > https://docs.jboss.org/jbossas/jboss4guide/r3/html/ch13.html
> > >
> > > On 9 March 2016 at 18:39, Vlad Mihalcea <mihalcea.vlad at gmail.com>
> wrote:
> > > > Hi,
> > > >
> > > > The part is backslashes comes from the absolute path set by Gradle
> when
> > > > supplying the module OS folder.
> > > > The right part containing slashes is the one set in persistence.xml.
> > > > I'll try to replace backslashes with slashes and see how it goes.
> > > >
> > > > I was curious if people use the jar-file with absolute paths because
> the
> > > > JPA spec only implies it in the context of relative paths inside an
> EAR
> > > or
> > > > WAR.
> > > > As for PAR, I guess that was included in some JPA 1.0 draft but it
> got
> > > > rejected in the end, right?
> > > >
> > > > Vlad
> > > >
> > > >
> > > >
> > > >
> > > > On Wed, Mar 9, 2016 at 6:39 PM, Emmanuel Bernard <
> emmanuel at hibernate.org
> > > >
> > > > wrote:
> > > >
> > > >> We usually strive on having functionalities work on both Java EE and
> > > >> Java SE.
> > > >> you example though shows a mix of forward and backslash in your
> > > >> <jar-file>, is that expected ?
> > > >>
> > > >> Emmanuel
> > > >>
> > > >> On Wed 2016-03-09 17:05, Vlad Mihalcea wrote:
> > > >> > Hi,
> > > >> >
> > > >> > I have two tests in the PackagedEntityManagerTest unit test that
> fail
> > > on
> > > >> my
> > > >> > machine, but work just fine for everybody else.
> > > >> > It could be an OS thing or not, but during the check, I found hat
> we
> > > are
> > > >> > testing against an use case that is not found in the JPA spec.
> > > >> >
> > > >> > The testExternalJar() creates an externaljar.jar and an
> > > explicitpar.par.
> > > >> >
> > > >> > I found an old reference on the PAR archive (
> > > >> > http://radio-weblogs.com/0135826/2005/07/07.html) but the JPA 2.1
> > > >> doesn't
> > > >> > mention anything about it.
> > > >> > The explicitpar.par contains the persistence.xml which contains a
> > > >> jar-file
> > > >> > attribute that references the externaljar.jar with an absolute
> path:
> > > >> >
> > > >> >
> > > >>
> > >
> <jar-file>D:\Vlad\Work\GitHub\hibernate-orm\hibernate-entitymanager\target/packages/externaljar.jar</jar-file>
> > > >> >
> > > >> > The JPA spec says that: "Such JAR files are specified relative to
> the
> > > >> > directory or jar file that contains the root of the persistence
> unit",
> > > >> and
> > > >> > gives several examples
> > > >> > for when using an EAR with or without a WAR.
> > > >> >
> > > >> > While debugging, I found that the JarFileBasedArchiveDescriptor
> scans
> > > the
> > > >> > "explicitpar.par" and looks for:
> > > >> >
> > > >> > if ( getEntryBasePrefix() != null && ! entryName.startsWith(
> > > >> > getEntryBasePrefix() ) ) {
> > > >> >     continue;
> > > >> > }
> > > >> >
> > > >> > where the getEntryBasePrefix() is
> > > >> >
> > > >>
> > >
> "D:/Vlad/Work/GitHub/hibernate-orm/hibernate-entitymanager/target/packages/externaljar.jar"
> > > >> >
> > > >> > The way that JarFileBasedArchiveDescriptor is implemented matches
> the
> > > JPA
> > > >> > description.
> > > >> > Nevertheless, the scan cannot locate the jar, and the entities
> that
> > > are
> > > >> > contained in the "externaljar.jar" don't get loaded, and the test
> > > fails.
> > > >> >
> > > >> > I can ignore this on my machine and just consider it a white
> noise,
> > > but I
> > > >> > wonder why we still check for PAR when we might want to have a
> test
> > > with
> > > >> an
> > > >> > EAR instead and relative paths.
> > > >> >
> > > >> > Vlad
> > > >> > _______________________________________________
> > > >> > hibernate-dev mailing list
> > > >> > hibernate-dev at lists.jboss.org
> > > >> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> > > >>
> > > > _______________________________________________
> > > > hibernate-dev mailing list
> > > > hibernate-dev at lists.jboss.org
> > > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> > > _______________________________________________
> > > hibernate-dev mailing list
> > > hibernate-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> > >
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list