Hi Michal,
I tried building a quick prototype based on your mapping, and I
couldn't reproduce the problem. But the code in your custom
"getUserList" method looks suspicious:
> Expression qualifier = ExpressionFactory.matchDbExp("UnitId", new
> BigDecimal(4));
Why is "4" hardcoded?
> query.setName("UserSelect");
> query.setCachePolicy(GenericSelectQuery.LOCAL_CACHE);
These two lines may definitely cause the problem. Cache is keyed using
query names. So if you used "UserSelect" name for another query
elsewhere things will get hairy... Even among two different instances
of Discipline you'll likely end up with incorrect results, so you have
to use the key unique for each Discipline instance.
Finally I am still confused about how you ended up having a piece of
SQL "WHERE t0.UnitId = NULL" (even if the parameter is indeed NULL, it
would've been translated as "WHERE t0.UnitId is NULL"). Strange...
Andrus
On Nov 8, 2004, at 2:58 PM, Michal Kozlowski wrote:
> Hi,
> Firstly thanks again for all the help you guys are offering me, and
> for the great product. I ran into a simple problem, which normally
> works but for some reason it don't work for this situation.
>
> I have 2 tables, they are on separate databases, so I have 2
> DataNodes, this normally isn't a problem as I have done this a couple
> of times. In this case I have one table Discipline that is related to
> a table(view) _UserInfo. The relation is Discipline->ExternalId =
> _UserInfo->UnitId. My Object Entities are Discipline and User, and I
> create a relationship called UserList and Discipline respectively to
> navigate the relationship. Problem is it doesn't work when I go
> Discipline.getUserList I get an empty list back and I should, the
> reason is that is create this query which have errors
>
> INFO QueryLogger: SELECT t0.Disabled, t0.FirstName, t0.LastName,
> t0.LoginName, t0.UserId, t0.UnitId FROM dbo._UserInfo t0 WHERE
> t0.UnitId = NULL
> INFO QueryLogger: === returned 0 rows. - took 0 ms.
> INFO QueryLogger: +++ no commit - transaction controlled externally.
>
> The NULL field should not be there, it is a valid field that is set to
> not be NULL, I wrote a overloading function for getUserList that
> looks like this and it works
>
> public List getUserList()
> {
> Expression qualifier = ExpressionFactory.matchDbExp("UnitId", new
> BigDecimal(4));
>
> SelectQuery query = new SelectQuery(User.class, qualifier);
> query.setName("UserSelect");
> query.setCachePolicy(GenericSelectQuery.LOCAL_CACHE);
> query.setRefreshingObjects(false);
>
> List disciplineUsers = getDataContext().performQuery(query);
> return disciplineUsers;
> }
>
> So my question is what am I doing wrong in my cayenne information
> which I am attaching as well.
>
> Secondly how do I change the logging level of a query, I tried setting
> this up but I can't figure out were to put the cayenne-log.properties
> file. I running this as a tapestry application under Tomcat. Thanks
> for all the information and support.
>
> Cheers
> Mike
> <Actual DataMap.map.xml><Actual
> DataNode.driver.xml><cayenne.xml><Forecast DataMap.map.xml><Forecast
> DataNode.driver.xml>
This archive was generated by hypermail 2.0.0 : Mon Nov 08 2004 - 20:33:24 EST