enjoyourlife (1) [Avatar] Offline
#1
I import maven project using eclipse(luna) and encounter some errors..

1. xmlns in persistence.xml

<persistence
version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence_2_1.xsd">


Eclipse shows following errors.

... Referenced file contains errors (http://xmlns.jcp.org/xml/ns/persistence_2_1.xsd). For more information..

So, I changed it like below,

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">


2. I cannot find the class in persistence.xml like <class>org.jpwh.model</class>
It seems just package, no class. So, i delete it.


<persistence-unit name="SimplePU">
<jta-data-source>myDS</jta-data-source>
<mapping-file>simple/Queries.xml</mapping-file>
<class>org.jpwh.model</class>

.....
<persistence-unit name="myPU">
<jta-data-source>myDS</jta-data-source>
<class>org.jpwh.helloworld</class>
<class>org.jpwh.helloworld.Message</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>


3. No generator named “X” is defined in the persistence unit – Eclipse JPA
https://gokceng.wordpress.com/2012/01/02/no-generator-named-x-is-defined-in-the-persistence-unit-eclipse-jpa/

4. maven-antrun-plugin problem
You may encounter this problem when you importing maven project. i just disabled it by clicking eclipse error indicator.
Eclipse will insert following configuration to pom.xml

<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
<versionRange>
[1.7,)
</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>


5. some errors in example project like below...

CreditCard_, Item_ classes seems does not exist. Many classes have this kinds of errors.


package org.jpwh.test.bulkbatch;

import org.jpwh.env.JPATest;
import org.jpwh.model.bulkbatch.BankAccount;
import org.jpwh.model.bulkbatch.Bid;
import org.jpwh.model.bulkbatch.CreditCard;
import org.jpwh.model.bulkbatch.CreditCard_;
import org.jpwh.model.bulkbatch.Item;
import org.jpwh.model.bulkbatch.Item_;

....
siebica (3) [Avatar] Offline
#2
Please find some answers below:

2. I believe this is the extension that Hibernate provides for including the package-info.java (the file you can put your named queries inside)

Please check https://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/configuration.html#setup-configuration-packaging
As an extension to the specification, you can add a package name in the <class> element (eg <class>org.hibernate.eg</class> ). Caution, the package will include the metadata defined at the package level (ie in package-info.java), it will not include all the classes of a given package.


5. The CreditCard_, Item_ metadata classes are generated during the build process and you can find them under model/target/generated-sources/annotations. The book talks about this strongly typed metadata model at page 45 of MEAP v8
424033 (1) [Avatar] Offline
#3
Hello,

I spent hours trying to import the project within Eclipse Luna. I tried different plugins, searched the web for the many error messages I got with no success.

Is it possible for you to provide online an Eclipse version tu run the sample codes (or at least to give us in a README file indications concerning the necessary plugins) ? Because for the moment it looks as if the targeted audience was rather persons having a good knowledge of Maven and Hibernate (or both) than pure Java developers?

Best regards,

557394 (2) [Avatar] Offline
#4
I recently purchased the second edition of this book and tried to set up the project on my laptop. I experienced some of the issues listed here among which issue 5 took some of my time. Maven build for the complete project solved the issue in my case. I see the generated classes under model project. However out of curiosity I would like to know whether there is a way to resolve errors seen on eclipse for examples project. The examples project cannot resolve the generated classes in eclipse after a complete build of the entire codebase. The dependencies of examples include model and environment projects. However these projects are currently displayed as projects rather than jars under maven dependencies of examples project in my eclipse workspace. Any thoughts is greatly appreciated.

issue 6. I am setting up this project in windows. I faced an issue related to jconsole dependency of wildfly-arquillian-container-remote artifact. I solved it by updating the pom file of apps/pom.xml as below:

<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>${wildfly.version}</version>
<exclusions>
<exclusion>
<groupId>sun.jdk</groupId>
<artifactId>jconsole</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
557394 (2) [Avatar] Offline
#5
Hi,
I found the solution to issue 5 while setting it up on eclipse. The issue was resolved by disabling project resolution in maven plugin. An old post regarding the same is:

https://stackoverflow.com/questions/12577175/how-to-tell-maven-to-include-the-jar-dependency-not-the-subproject-source-direc

However I used the instruction below:

https://stackoverflow.com/questions/34725294/m2eclipse-resolving-maven-dependencies-from-the-eclipse-workspace

https://books.sonatype.com/m2eclipse-book/reference/eclipse.html#eclipse-sect-resolving-dependencies

Thanks.