Quarkus javax.persistence without ORM - jpa

Is it possible to reference a library to get only javax.persistence without having to configure hibernate or other ORM?
I have a library that I want to contain my entities, which will be added to other projects as part of a Maven repository reference. The Data Access will actually only happen on the project using this as a dependency.
I don't want to have to configure hibernate or add a reference to it just to gain access to the JPA api.
Any ideas?
Thank you

Maybe (in Maven):
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>

If you use a Java EE server :
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<scope>provided</scope>
</dependency>

Related

Conflicting module versions. Module [groovy-xml is loaded in version 4.x.x and you are trying to load version 3.x.x

I am working to setup wiremock for springboot rest api and using rest assured and spring-cloud-starter-contract-stub-runner from spring cloud. when i run the sample integration test i encounter module conflict error
check your dependency tree of pom file. The reason for the error is there were two groovy libs in your class path with different versions and this is causing the conflict
One from rest-assured dependency and other from spring-cloud-starter-contract-stub-runner dependency
Solution is to remove rest assured and replace it with restdocs-api-spec-restassured dependency. This way you can use rest assured with out additional groovy dependency
. your class path will only have 1 groovy from spring-cloud-starter-contract-stub-runner dependency
Found this workaround on Rest Assured's GitHub page. You replace Rest Assured's dependency with this one
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>5.1.1</version>
<scope>test</scope>
<exclusions><!-- https://www.baeldung.com/maven-version-collision -->
<exclusion>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-xml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>5.1.1</version>
<scope>test</scope>
</dependency>
Rest Assured's Github Page
1 just manually remove rest-assured dependency from POM file.
2 add to the pom file
<dependency>
<groupId>com.epages</groupId>
<artifactId>restdocs-api-spec-restassured</artifactId>
<version>0.10.4</version>
</dependency>
3 Maven clean
4 Maven Compile
5 Maven - Reload(refresh)

Is it possible to use #Join annotation of Rewrite on JoinFaces?

I'd like to use #Join annotation in a joinFaces project.
If it's possible, what the steps to configure and use it?
I'm using joinFaces 3.2.4 with rewrite-spring-boot-starter.
Actually i found very very beautiful solution on this link By JSF itself
page-redirect
hopefully be useful
https://www.codenotfound.com/jsf-welcome-page-redirect-example-spring-boot.html
I sent alot of time on it with no hope with Spring boot, But if you want
you need to add this dependencies
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-servlet</artifactId>
<version>3.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-integration-faces</artifactId>
<version>3.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-config-prettyfaces</artifactId>
<version>3.4.2.Final</version>
</dependency>

Using Guava bundled with GWT

GWT 2.2 and later includes Guava. The package containing Guava is com.google.gwt.thirdparty.guava. However, there doesn't seem to be a module XML file that would allow this package to be used in client (translatable) code. Based on this observation, it would seem that this copy of Guava is intended for GWT-internal use only.
For GWT projects using Guava, is the suggested approach to download Guava separately? If not, what is the process for including com.google.gwt.thirdparty.guava in client code?
Yes, if you want to use Guava yourself, you'll need the guava and guava-gwt jars, and reference the modules you want in your gwt.xml file. In the past, you've also needed jsr305, although my understanding is that this was being fixed, so you may not need that in r09
Your assumption is correct; it's for internal use only; download it separately. If using Maven, include the following in your pom.xml:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r07</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r07</version>
<classifier>gwt</classifier>
<scope>provided</scope>
</dependency>
<!-- for the source/classes for javax.annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>1.3.9</version>
<scope>provided</scope>
</dependency>

Scala JPA in netbeans

I am learning Java EE 6 but wants my Entities in scala and am also using netbeans. I created a scala class library but I cannot use javax.persistence._ even if I add the eclipselink library I can't import it. NB: I've tried eclipse but always having problems especially with glassfish thus I want to use netbeans and have java web project depend on the scala class library. I also like vim and netbeans have a perfect plugin for that. Not dishing eclipse but I am always suffering when I tried to use eclipse with Java EE 6 compared to netbeans.
You can use Maven to configure your dependencies for JavaEE and your specific JPA provider, for example:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>toplink.essentials</groupId>
<artifactId>toplink-essentials</artifactId>
<version>2.1-60f</version>
</dependency>
Notes:
To use javax.persistence classes, you need javax.persistence dependency.
Im using Java EE 7 but in your case, change "7.0" to "6.0"
Toplink is my JPA provider (you can use EclipseLink, Hibernate, ...), for example:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.6.0</version>
</dependency>
Or another provider at this link:
JPA provider

Maven missing transitive dependency

I have a maven project with a dependency (datanucleus-db4o). This dependency has itself a dependency on db4o (db4o:db4o:jar:7.12.126.14142-all-java5).
Now maven says:
09.09.10 19:43:09 MESZ: Missing artifact db4o:db4o:jar:7.12.126.14142-all-java5:compile
I am new to maven. Is it right that datanucleus-db4o defines its own dependency with a specific version number? Is this a good way? m2eclipse can't download it. I downloaded a newer Version of db4o and added it to the classpath. Maven keeps writing about the missing artifact.
Also I've got NoClassDefFound errors when I launch my application. This leads me to the other question:
Am I doing something wrong?
Thanks in advance.
Here is the relevant part of the pom.xml...
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>2.2.0-m1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-db4o</artifactId>
<version>2.1.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
and here is the relevant part of the pom.xml of
<dependency>
<groupId>db4o</groupId>
<artifactId>db4o</artifactId>
<version>7.12.126.14142-all-java5</version>
</dependency>
Is it right that datanucleus-db4o defines its own dependency with a specific version number? Is this a good way?
I'm not sure I understood the question... Anyway, there is indeed something wrong with the db4o:db4o dependency of the datanucleus-db4o artifact: it is not available in Maven central nor in the DataNucleus repository. I don't understand how users are supposed to use the datanucleus-db4o artifact.
I downloaded a newer Version of db4o and added it to the classpath. Maven keeps writing about the missing artifact.
Not sure what you did exactly but maybe the following will work: exclude the dependency that can't be resolved and replace it with some equivalent from the db4o repository.
<dependencies>
...
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-db4o</artifactId>
<version>2.1.1</version>
<type>jar</type>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>db4o</groupId>
<artifactId>db4o</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.db4o</groupId>
<artifactId>db4o-full-java5</artifactId>
<version>7.12-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
...
<repository>
<id>db4o</id>
<url>https://source.db4o.com/maven</url>
</repository>
</repositories>
I have no idea if this will work of course.
Also I've got NoClassDefFound errors when I launch my application. This leads me to the other question:
Can't say since you didn't post the error. But give the above a try.
The required file is not in the maven repositories, but it is in the datanucleus zip file (that one with all dependencies). Look into the /deps folder.
I unpacked it and installed it into the local maven repository with this command:
./mvn install:install-file -Dfile=/home/myUser/Downloads/db4o-7.12.126.14142-all-java5.jar -DgroupId=db4o -DartifactId=db4o -Dversion=7.12.126.14142-all-java5 -Dpackaging=jar
After that it is found by maven. Now there are other problems going on. I'll try to solve them myself...
Seems like the JDO or Datanucleus stuff is not well organized at the moment. I think they refactored some classes and now they can't be found at some versions and implementations are incompatible with the api and such stuff.