Re: If I've made a class for an EO entity, can I use it to add data to?
Re: If I've made a class for an EO entity, can I use it to add data to?
- Subject: Re: If I've made a class for an EO entity, can I use it to add data to?
- From: Bill Reynolds <email@hidden>
- Date: Tue, 20 Jul 2004 08:43:41 -0700
Amorya,
It's better to create an instance of the Object 'Members', modify all it's
properties during your interaction with the user, and if they do 'submit'
then use a method to insert this new record in it's entirety. In other
words do the dbase insertion very last. Of course you'll have to contend
with making sure that each field(s) data type, length, non-Null, etc. is all
enforced through your data gathering to assure a trouble-free insert, but be
prepared if it's not. Either way you want to make sure you're working with
the object and not just inserting potential orphaned and useless data :)
-Bill
on 7/20/04 8:16, Amorya North at email@hidden wrote:
> On 20 Jul 2004, at 1:57 pm, Amorya North wrote:
>
>> I'm implementing a registration page for users on my site.
>>
>> I have an EO Entity called Members. This maps onto a Java class called
>> Members (class generated by EOModeller).
>>
>>
>> What I want to do is add data directly to a new Members object...
>>
>
> OK, I've sort of managed it...
>
> I added this to the code that runs when the Register page is opened:
>
> public Register(WOContext context) {
> super(context);
> creatingMember = (Members) EOUtilities.createAndInsertInstance(ec,
> "Members");
> }
>
> I still reckon that's bad practise though... What if a user goes to the
> page, but doesn't click submit? There'd be a random record hanging
> around. Or what happens if they go to it multiple times, then
> eventually submit - they'd add more than one record!
>
> Any tips?
>
> Amorya
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.