Eduardo Born

Greenhorn
+ Follow
since Oct 26, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eduardo Born

Some more information...

The criteria query that generated this error was built this way:




The Role and Permission classes have been mapped with JPA and some Hibernate annotations like this:





I was expecting the call to typedQuery.getResultList() to return a list of collections with just one element: the collection of permission objects for the role with id = 2. This is an attempt to select just the "permissions" collection from the object role with id = 2.

I'm new to criteria queries and I'm having a hard time finding what's wrong with it.

What would be the correct criteria query to accomplish this?

Thank you!!

Eduardo
Hello!
I have criteria query that, when executed, results the following exception thrown:



The id attribute is the entity's attribute which was annotated with @Id @GeneratedValue. Basically I'm trying to load the attribute "permissions", which is a collection uninitialized at the time, for the role object whose id is 2. The id attribute is of long type.

Any ideas on why this query would fail?

It seems correct to me...

I can post the code that creates the criteria query here, but it is fairly complicated (as it generates based on a LDAP filter, etc), so I'm hoping the error will be visible from the generated query string and the exception. Please let me know if that's not the case.

Thanks!!
Eduardo Born
13 years ago
Hello!
I have criteria query that, when executed, results the following exception thrown:



The id attribute is the entity's attribute which was annotated with @Id @GeneratedValue. Basically I'm trying to load the attribute "permissions", which is a collection uninitialized at the time, for the role object whose id is 2. The id attribute is of long type.

Any ideas on why this query would fail?

It seems correct to me...

I can post the code that creates the criteria query here, but it is fairly complicated (as it generates based on a LDAP filter, etc), so I'm hoping the error will be visible from the generated query string and the exception. Please let me know if that's not the case.

Thanks!!
Eduardo Born