'Newbie' hits another Brick Wall ... and it begins to hurt

Posts   
 
    
CliffH
User
Posts: 52
Joined: 03-May-2006
# Posted on: 25-May-2006 14:55:24   

In my designer I see the following:-

Entity: Booking Relations: Booking - Passenger (1:n) Booking - Service (1:n)

Entity: Service Relations: Service - ServicePrice (1:n) - for every service there are 1 or more prices.

I've been happily doing Booking.Passenger.Add( passenger) booking.Service.Add( service )

and saving recursively. But when I try to do

booking.service.serviceprice.add( serviceprice )

this doesn't seem to be possible. Why not, and if not what do I have to do to get it to work.

CliffH
User
Posts: 52
Joined: 03-May-2006
# Posted on: 25-May-2006 14:59:23   

Forget this guys ... did this in haste ... the brick wall wasn't there at all, or if it was it was a delusion.

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 25-May-2006 16:12:27   

Ok, but that was an awesome title for your post!

CliffH
User
Posts: 52
Joined: 03-May-2006
# Posted on: 25-May-2006 16:33:01   

... wasn't meant to be like that. Maybe a bit of paranoia set it. I went with this tool with a 'gut feel' that it was a good candidate for the job, looked at other ORM tools and thought that this had a bit mor to offer.

Indeed it does has a lot more. Just that the learning curve can be quite steep and the brick walls can make you unproductive ... not a situation I'm used to.

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 25-May-2006 16:42:56   

Believe me, once you pass that learning soon (and it will be sooner than you expect) you'll be flying like a rocket simple_smile

CliffH
User
Posts: 52
Joined: 03-May-2006
# Posted on: 25-May-2006 18:21:17   

Help me fly man ... I'm grounded.

I thought this recursive save would be easy.

Booking has passengers Booking has Services Services have prices All 1:n relationships

Adding passenger and service to booking and doing a recursive save works fine.

However, as soon as I add a ServicePrice entity I run into problems:=

An unhandled exception of type 'SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException' occurred in bl.dll

Additional information: An exception was caught during the execution of an action query: Cannot insert the value NULL into column 'Service_ID', table 'Yatra.dbo.ServicePrice'; column does not allow nulls. INSERT fails. The statement has been terminated.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.

Now recursive saves should assign this fkey value because PK Service.Service_ID has a value.

Any thoughts before I shoot myself !!!!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 25-May-2006 20:05:48   

Recursive saves work when you assign the entities to eachother. Did you do: myService.Prices.Add(myPrice) ?

PLease post some (not 1000's of lines wink ) code which constructs the graph and saves it so we can tell you what you might did wrong.

Frans Bouma | Lead developer LLBLGen Pro
CliffH
User
Posts: 52
Joined: 03-May-2006
# Posted on: 26-May-2006 03:34:04   

Apologies for this. It does indeed work as expected.