You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But, when I get the Game from the database it is always returning me an empty list
@TestpublicvoidshouldFindAllGamesUsingJpqlQuery() throwsException {
// givenStringfetchingAllGamesInJpql = "select g from Game g order by g.id";
// whenSystem.out.println("Selecting (using JPQL)...");
List<Game> games = em.createQuery(fetchingAllGamesInJpql, Game.class).getResultList();
// thenSystem.out.println("Found " + games.size() + " games (using JPQL):");
for (Gamegame : games) {
System.out.println(game);
System.out.println("Consoles: " + game.getConsoles().size());
for (Consoleconsole : game.getConsoles()) {
System.out.println(console);
}
System.out.println("*********");
}
assertContainsAllGames(games);
}
And when I try get the consoles on Console table on database, I can retrieve all of them associated with a Game.
@TestpublicvoidshouldFindAllConsolesWithGamesWithJPQL() throwsException {
Stringsql = "SELECT c FROM Console c ORDER by c.id";
List<Console> consoles = em.createQuery(sql, Console.class).getResultList();
System.out.println("Found " + consoles.size() + " consoles (JPQL)");
for (Consoleconsole : consoles) {
System.out.println(console);
}
}
Current Behaviour
When I get a Game from the database it is always returning me an empty list.
Additional Information
All changes was made over Arquillian Persistence Tutorial
I'm running GamePersistenceTest.java as a JUnit Test on Eclipse IDE Version: Oxygen.2 (4.7.2)
I'm facing this problem on a personal project when running on a JUnit environment, but if I publish it on my local WebLogicServer I do not have this problem and the list returns with the expected result.
The text was updated successfully, but these errors were encountered:
Hi @tmussi thanks for detailed issue report. Is there any chance you can share this modified version?
Additional question - in your personal project what exact environment you are running tests against? This like those on the list below would greatly help troubleshooting
Issue Overview
Relationship mapped with
@OneToMany
always returning an empty list.I made some changes on Arquillian Persistence Tutorial adding
consoles
attribute onGame.java
as you can see below:And creating a new class called
Console.java
Expected Behaviour
On
GamePersistenceTest.java
class, I updated the methodinsertData()
to look like this:But, when I get the
Game
from the database it is always returning me an empty listAnd when I try get the consoles on Console table on database, I can retrieve all of them associated with a
Game
.Current Behaviour
When I get a
Game
from the database it is always returning me an empty list.Additional Information
All changes was made over Arquillian Persistence Tutorial
I'm running
GamePersistenceTest.java
as a JUnit Test on Eclipse IDE Version: Oxygen.2 (4.7.2)I'm facing this problem on a personal project when running on a JUnit environment, but if I publish it on my local WebLogicServer I do not have this problem and the list returns with the expected result.
The text was updated successfully, but these errors were encountered: