Sorry, I wasn't terribly specific. Yes, at the moment the compiler doesn't
seem to mind returning the ObjectKey but getValue() returns an Object, not
an int, and looking at the ObjectKey code it looks like nearly anything can
be used as the primary key. I tried assuming this was an Integer, casting
and using intValue() but that didn't get me very far. I see that NumberKey
uses BigDecimal internally to keep track of it's counter -- do you think
I'd be safe in casting ObjectKey to a NumberKey and then pulling out it's
BigDecimal and then pulling out ITS int value?
And why is this so difficult? :P (and yes, Quinton, ASAP I plan to extend
TurbineUser but I have a deadline Wed. for a demo ver and this is just
icing)
-j
Bill
<bhalpin@collaborative To: Turbine Users List
fusion.com> <[EMAIL PROTECTED]>
cc:
12/16/2002 11:15 AM Subject: Re: Access to current
user ID?
Please respond to
"Turbine Users List"
J
Sorry I didnt realize you were trying to pass an int. You just need to
convert the ObjectKey that is being returned to an int value. Take a
look at the API for details on how to convert it:
http://icu-web.org/turbine-docs/apidocs/overview-summary.html
I think getValue() will return the underlying int value you want.
if you have the cast class exception, re-post I have some other ideas
you could try. Also when I looked at your previous code snippet, you
were accessing the userid of User as getUserId() but I believe the
column name is user_id which would mean the method should be
getUser_id() instead.
-b
On Mon, 2002-12-16 at 20:58, [EMAIL PROTECTED] wrote:
>
> No, this reports:
>
> [javac] appname\WEB-INF\src\java\com\genelogic\appname\modules\
> actions\MyFormActions.java:62: setAddedBy(int) in com.gen
> elogic.appname.om.BaseSampleSet cannot be applied to
> (org.apache.torque.om.Object
> Key)
>
> [javac] newSet.setAddedBy(( (TurbineUser) data.getUser()
> ).getPrimaryKey());
> [javac] ^
> [javac] 1 error
>
> Though I have a feeling even if this did compile it would leave me w/
> another class cast exception (since turbine.om.security.User seems to
> dislike being cast to TurbineUser within my own om).
> -j
>
>
>
>
> Bill
> <bhalpin@collaborative To: Turbine
Users List
> fusion.com>
<[EMAIL PROTECTED]>
> cc:
> 12/16/2002 07:36 AM Subject: Re: Access
to current user ID?
> Please respond to
> "Turbine Users List"
>
>
>
>
>
>
> On Mon, 2002-12-16 at 17:07, [EMAIL PROTECTED] wrote:
> >
>
> > newA.setAddedBy(data.getUser().getUserId()); <-- doesn't work
>
> this should work:
>
> ( (TurbineUser) data.getUser() ).getPrimaryKey()
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>