Question

I was asking on #arquillian Freenode IRC channel about question

Arquillian JPA tutorial: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor

when a user told me that he successfully runned

https://github.com/arquillian/arquillian-examples/tree/master/arquillian-persistence-tutorial

so I did

git clone https://github.com/arquillian/arquillian-examples.git

then in Eclipse, I clicked File->Import->Existing Maven Projects and selecte the subdirectory

arquillian-examples/arquillian-persistence-tutorial

Once Eclipse finished importing the project, I obtain in file

/src/test/java/org/arquillian/example/GamePersistenceTest.java

line 146, the error message

Game_ cannot be resolved to a variable

What can I do? In my attempt at the link at beginning of the page, this did not happpen. I did not change any file downloaded from git repo.

Folder tree

.
├── pom.xml
├── src
│   ├── main
│   │   ├── java
│   │   │   └── org
│   │   │       └── arquillian
│   │   │           └── example
│   │   │               └── Game.java
│   │   └── resources
│   │       └── META-INF
│   │           └── persistence.xml
│   └── test
│       ├── java
│       │   └── org
│       │       └── arquillian
│       │           └── example
│       │               └── GamePersistenceTest.java
│       ├── resources
│       │   ├── arquillian.launch
│       │   ├── arquillian.xml
│       │   └── jbossas-ds.xml
│       ├── resources-glassfish-embedded
│       │   ├── glassfish-resources.xml
│       │   ├── logging.properties
│       │   └── test-persistence.xml
│       ├── resources-glassfish-remote
│       │   └── test-persistence.xml
│       └── resources-jbossas-managed
│           └── test-persistence.xml
└── target
    ├── classes
    │   ├── META-INF
    │   │   ├── MANIFEST.MF
    │   │   ├── maven
    │   │   │   └── org.arquillian.example
    │   │   │       └── arquillian-persistence-tutorial
    │   │   │           ├── pom.properties
    │   │   │           └── pom.xml
    │   │   └── persistence.xml
    │   └── org
    │       └── arquillian
    │           └── example
    │               └── Game.class
    └── test-classes
        ├── arquillian.launch
        ├── arquillian.xml
        ├── glassfish-resources.xml
        ├── jbossas-ds.xml
        ├── logging.properties
        ├── org
        │   └── arquillian
        │       └── example
        │           └── GamePersistenceTest.class
        └── test-persistence.xml

30 directories, 24 files
Was it helpful?

Solution

The _Game class in that example is generated by the Hibernate JPA 2 metamodel generator (hibernate-jpamodelgen) that is defined as a dependency in the project POM. You'll now need to generate the metamodel by employing one the options outlined in the metamodel generator reference guide.

You could use Eclipse itself by configuring the annotation processing phase. Or you could modify the POM to use the maven-compiler-plugin configuration specified in the guide, to run as part of your build.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top