Hi guys,

I'm having a bit of a brain freeze right now trying to figure out how
to handle something which is probably pretty simple.

I have a user object which has a manytoone relationship with a message
object.

I essentially make a call to my gateway to retrieve the latest message
a user has received and store it in the user object. This all works
fine if the user  has received a message. However, if they have not
Transfer will error when I try to save the user object complaining
that the manytoone has not been persisted - which is perfectly true.
In this case when I asked for the latest message I was given a non-
persisted message object (id=0).

What is the best way to handle the case where the user does not yet
have a latest message and simply place 0 in the lnkIDMessage field?

I have a feeling this is probably not a good way to handle things. I
set this up a while ago as I felt it would be useful to be able to ask
the user object what the latest message is that the user has received:

getCurrentUser().getLatestMessage()

It's just handling a null case that is baffling me. I know having a
generic persisted message in the d/b would solve this but that feels
pretty nasty as well.

Any advice would be appreciated.

Cheers,
James.
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to