Bug 103411
Summary: | DataQuery.addPath() with > 1 object type in the path causes query to fail | ||
---|---|---|---|
Product: | [Retired] Red Hat Web Application Framework | Reporter: | Mike Bonnet <mikeb> |
Component: | persistence | Assignee: | Archit Shah <archit.shah> |
Status: | CLOSED RAWHIDE | QA Contact: | Jon Orris <jorris> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.0 | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2003-10-07 22:04:46 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 100952 |
Description
Mike Bonnet
2003-08-29 21:30:28 UTC
Here's the full text of the conversation between Rafi and I: (16:09:46) Me: ping (16:09:52) Rafi Schloming: pong (16:11:08) Me: Hey, I'm trying to use DataQuery.addPath to filter on attributes of associated objects, and I'm getting an IllegalStateException at RecordSet:151 (16:11:18) Me: "container is null but value isn't (16:11:21) Me: " (16:11:31) Me: Any idea why that would be? (16:12:58) Rafi Schloming: Are you doing this with a freaky data query? (16:13:18) Me: No, a SessionManager.getSession().retrieve(String) (16:13:38) Rafi Schloming: What that means is that the record set is trying to translate a flat row returned by the query into an object graph. (16:14:04) Rafi Schloming: And it encoutered an inconsistent set of values. (16:14:30) Rafi Schloming: Namely somePath.id is null, but somePath.attribute is not null. (16:15:13) Rafi Schloming: Which isn't consistent since somePath.attribute needs to be contained in *some* object. (16:15:22) Me: Does the addPath() let you reference attribute in collection associations? (16:15:52) Rafi Schloming: But if somePath.id is null then there is no way to tell where in the session to put the attribute value. (16:16:02) Rafi Schloming: Yes, I believe it does. (16:16:34) Me: If I only want the id, can I reference "somePath.id" ? (16:16:39) Rafi Schloming: It will change the multiplicity of your query though unless you add a filter that constrains stuff appropriately. (16:16:45) Rafi Schloming: Yeah you can. (16:17:11) Me: Hmmm, okay, let me take a look at the code again. (16:17:35) Rafi Schloming: I'd say the possible causes are: (16:17:58) Rafi Schloming: 1. addPath() isn't doing quite the right thing since it should be automatically adding id properties if they aren't specified. (16:18:40) Rafi Schloming: 2. SQL generation is producing a wacked out query that is returning null values for ids and non null values for attributes. (16:19:25) Rafi Schloming: If you turn logging for com.redhat.persistence up to INFO we should be able to figure out whats going on pretty easily. (16:19:51) Rafi Schloming: It will print the query it is actually executing along with the values it's resurrecting and soforth. (16:21:12) Me: okay (17:15:32) Me: So I was doing something like 'query.addPath("assoc1.assoc2.assoc3.id")' and it was failing. Explicitly doing: query.addPath("assoc1.id"); query.addpath("assoc1.assoc2.id"); etc. caused it to work. (17:16:53) Rafi Schloming: Ah yes, so I just need to make it auto-add id properties all the way up the path being added. (17:17:04) Rafi Schloming: I probably forgot the recursive check or something like that. (17:17:08) Me: Yes, that sounds like the issue (17:17:22) Rafi Schloming: Wanna file a bz? (17:17:27) Me: sure (17:17:38) Rafi Schloming: thanks fixed on 6.0 branch (35593) and tip (35575, 35590) |