Re: Changing from horizontal to single table inheritance

2013-10-09 Thread Mark Wardle
Thanks all. Alternate data stores are an intriguing idea - I already switched 
away from using PostgreSQL to implement SNOMED_CT in favour of Lucene as the 
free text searching was too slow with PostgreSQL. That said, it is nice that 
some of the data collection forms have relational constraints to other parts of 
the patient record. 

Good to think about this, but I think I'll park the ideas for now. Only issue 
is keeping a hand on performance metrics and considering again if we do hit a 
problem.

Best wishes,

Mark

On 6 Oct 2013, at 21:02, Kieran Kelleher  wrote:

> Might be worth checking a Graph Database such as Neo4j as a possible solution 
> for your domain model requirements.
> 
> The book: http://amzn.com/1449356265
> 
> Free PDF Version of the book: http://graphdatabases.com
> 
> 
> On Oct 6, 2013, at 2:08 PM, Ramsey Gurley  wrote:
> 
>> You need a schema-less approach if you need to create these things at 
>> runtime. Relational databases really aren't such a good fit in these cases. 
>> You can shoe horn something into a RDBMS with EAV or datablobs, but it won't 
>> scale well.
>> 
>> If you're using Postgres 9.2.x or better, there is built in JSON data 
>> storage you could use. You can write stored procedures using PLV8, an 
>> embedded V8 javascript engine. It's also faster than 
>> MongoDB based on what I've read.
>> 
>> 
>> 
>> On Sat, Oct 5, 2013 at 2:25 PM, Mark Wardle  wrote:
>> Thanks both,
>> 
>> This advice is all very helpful. I might do some performance measurement to 
>> see whether keeping horizontal inheritance is actually causing problems. I 
>> think I'm batch fetching which should mean joining on multiple tables and 
>> not a SELECT on each and every entity. 
>> 
>> The problem is that with single table inheritance, combining all data forms, 
>> I will end up with a database table with 449 columns - which might have its 
>> own set of problems!
>> 
>> Out of curiosity, am I going to hit any problems combining approaches? Using 
>> single table inheritance when there are many common properties and using 
>> horizontal inheritance when the majority of properties are not shared.
>> 
>> What I should do instead is write a generic entity which itself stores a 
>> runtime-defined, stored in the database (and modelling in EOF) bunch of 
>> properties in an NSDictionary and has logic provided a runtime chosen 
>> delegate. Then I could create new data collection forms using a dedicated UI 
>> and little overhead. Then we'd just set-up a bunch of D2W rules to ask the 
>> generic entity for displayPropertyKeys etc. for the appropriate fake entity. 
>> Anyone created fake entities like this either?
>> 
>> Best wishes,
>> 
>> Mark
>> 
>> 
>> On 4 Oct 2013, at 19:23, Chuck Hill  wrote:
>> 
>>> On 2013-10-04 11:06 AM, "Ramsey Gurley" wrote:
>>> 
>>> Not to contradict Chuck (he is always right), 
>>> 
>>> Will someone PLEASE tell my wife?
>>> 
>>> 
>>> -- 
>>> Chuck Hill 
>>> Executive Managing Partner, VP Development and Technical Services
>>> 
>>> Practical WebObjects - for developers who want to increase their overall 
>>> knowledge of WebObjects or who are trying to solve specific problems.
>>> http://www.global-village.net/gvc/practical_webobjects
>>> 
>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest 
>>> Growing Companies in B.C! 
>>> 
>>> Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of 
>>> Canada’s Fastest-Growing Companies by PROFIT Magazine!
>> 
>> -- 
>> Dr. Mark Wardle
>> Consultant Neurologist, University Hospital Wales, Cardiff, UK
>> Email: mark.war...@wales.nhs.uk or m...@wardle.org  Twitter: @mwardle
>> Telephone: 02920745274 (secretary) or facsimile: 02920744166
>> 
>> 
>> 
>> 
>> 
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com
>> 
>> This email sent to kelleh...@gmail.com
> 

-- 
Dr. Mark Wardle
Consultant Neurologist, University Hospital Wales, Cardiff, UK
Email: mark.war...@wales.nhs.uk or m...@wardle.org  Twitter: @mwardle
Telephone: 02920745274 (secretary) or facsimile: 02920744166





 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Changing from horizontal to single table inheritance

2013-10-06 Thread Kieran Kelleher
Might be worth checking a Graph Database such as Neo4j as a possible solution 
for your domain model requirements.

The book: http://amzn.com/1449356265

Free PDF Version of the book: http://graphdatabases.com


On Oct 6, 2013, at 2:08 PM, Ramsey Gurley  wrote:

> You need a schema-less approach if you need to create these things at 
> runtime. Relational databases really aren't such a good fit in these cases. 
> You can shoe horn something into a RDBMS with EAV or datablobs, but it won't 
> scale well.
> 
> If you're using Postgres 9.2.x or better, there is built in JSON data storage 
> you could use. You can write stored procedures using PLV8, an embedded V8 
> javascript engine. It's also faster than MongoDB based 
> on what I've read.
> 
> 
> 
> On Sat, Oct 5, 2013 at 2:25 PM, Mark Wardle  wrote:
> Thanks both,
> 
> This advice is all very helpful. I might do some performance measurement to 
> see whether keeping horizontal inheritance is actually causing problems. I 
> think I'm batch fetching which should mean joining on multiple tables and not 
> a SELECT on each and every entity. 
> 
> The problem is that with single table inheritance, combining all data forms, 
> I will end up with a database table with 449 columns - which might have its 
> own set of problems!
> 
> Out of curiosity, am I going to hit any problems combining approaches? Using 
> single table inheritance when there are many common properties and using 
> horizontal inheritance when the majority of properties are not shared.
> 
> What I should do instead is write a generic entity which itself stores a 
> runtime-defined, stored in the database (and modelling in EOF) bunch of 
> properties in an NSDictionary and has logic provided a runtime chosen 
> delegate. Then I could create new data collection forms using a dedicated UI 
> and little overhead. Then we'd just set-up a bunch of D2W rules to ask the 
> generic entity for displayPropertyKeys etc. for the appropriate fake entity. 
> Anyone created fake entities like this either?
> 
> Best wishes,
> 
> Mark
> 
> 
> On 4 Oct 2013, at 19:23, Chuck Hill  wrote:
> 
>> On 2013-10-04 11:06 AM, "Ramsey Gurley" wrote:
>> 
>> Not to contradict Chuck (he is always right), 
>> 
>> Will someone PLEASE tell my wife?
>> 
>> 
>> -- 
>> Chuck Hill 
>> Executive Managing Partner, VP Development and Technical Services
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/gvc/practical_webobjects
>> 
>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest 
>> Growing Companies in B.C! 
>> 
>> Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of 
>> Canada’s Fastest-Growing Companies by PROFIT Magazine!
> 
> -- 
> Dr. Mark Wardle
> Consultant Neurologist, University Hospital Wales, Cardiff, UK
> Email: mark.war...@wales.nhs.uk or m...@wardle.org  Twitter: @mwardle
> Telephone: 02920745274 (secretary) or facsimile: 02920744166
> 
> 
> 
> 
> 
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com
> 
> This email sent to kelleh...@gmail.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Changing from horizontal to single table inheritance

2013-10-06 Thread Ramsey Gurley
You need a schema-less approach if you need to create these things at
runtime. Relational databases really aren't such a good fit in these cases.
You can shoe horn something into a RDBMS with EAV or datablobs, but it
won't scale well.

If you're using Postgres 9.2.x or better, there is built in JSON data
storage you could use. You can write stored procedures using PLV8, an
embedded V8 javascript engine. It's also faster than
MongoDB based on what I've read.



On Sat, Oct 5, 2013 at 2:25 PM, Mark Wardle  wrote:

> Thanks both,
>
> This advice is all very helpful. I might do some performance measurement
> to see whether keeping horizontal inheritance is actually causing problems.
> I think I'm batch fetching which should mean joining on multiple tables and
> not a SELECT on each and every entity.
>
> The problem is that with single table inheritance, combining all data
> forms, I will end up with a database table with 449 columns - which might
> have its own set of problems!
>
> Out of curiosity, am I going to hit any problems combining approaches?
> Using single table inheritance when there are many common properties and
> using horizontal inheritance when the majority of properties are not shared.
>
> What I should do instead is write a generic entity which itself stores a
> runtime-defined, stored in the database (and modelling in EOF) bunch of
> properties in an NSDictionary and has logic provided a runtime chosen
> delegate. Then I could create new data collection forms using a dedicated
> UI and little overhead. Then we'd just set-up a bunch of D2W rules to ask
> the generic entity for displayPropertyKeys etc. for the appropriate fake
> entity. Anyone created fake entities like this either?
>
> Best wishes,
>
> Mark
>
>
> On 4 Oct 2013, at 19:23, Chuck Hill  wrote:
>
>   On 2013-10-04 11:06 AM, "Ramsey Gurley" wrote:
>
>Not to contradict Chuck (he is always right),
>
>
>  Will someone PLEASE tell my wife?
>
>
>   --
>  Chuck Hill
> Executive Managing Partner, VP Development and Technical Services
>
>  Practical WebObjects - for developers who want to increase their overall
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/gvc/practical_webobjects
>
>  Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest
> Growing Companies in B.C!
>
> Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of
> Canada’s Fastest-Growing Companies by PROFIT Magazine!
>
>
> --
> Dr. Mark Wardle
> Consultant Neurologist, University Hospital Wales, Cardiff, UK
> Email: mark.war...@wales.nhs.uk or m...@wardle.org  Twitter: @mwardle
> Telephone: 02920745274 (secretary) or facsimile: 02920744166
>
>
>
>
>
>
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Changing from horizontal to single table inheritance

2013-10-05 Thread Mark Wardle
Thanks both,

This advice is all very helpful. I might do some performance measurement to see 
whether keeping horizontal inheritance is actually causing problems. I think 
I'm batch fetching which should mean joining on multiple tables and not a 
SELECT on each and every entity. 

The problem is that with single table inheritance, combining all data forms, I 
will end up with a database table with 449 columns - which might have its own 
set of problems!

Out of curiosity, am I going to hit any problems combining approaches? Using 
single table inheritance when there are many common properties and using 
horizontal inheritance when the majority of properties are not shared.

What I should do instead is write a generic entity which itself stores a 
runtime-defined, stored in the database (and modelling in EOF) bunch of 
properties in an NSDictionary and has logic provided a runtime chosen delegate. 
Then I could create new data collection forms using a dedicated UI and little 
overhead. Then we'd just set-up a bunch of D2W rules to ask the generic entity 
for displayPropertyKeys etc. for the appropriate fake entity. Anyone created 
fake entities like this either?

Best wishes,

Mark


On 4 Oct 2013, at 19:23, Chuck Hill  wrote:

> On 2013-10-04 11:06 AM, "Ramsey Gurley" wrote:
> 
> Not to contradict Chuck (he is always right), 
> 
> Will someone PLEASE tell my wife?
> 
> 
> -- 
> Chuck Hill 
> Executive Managing Partner, VP Development and Technical Services
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/gvc/practical_webobjects
> 
> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing 
> Companies in B.C! 
> 
> Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of 
> Canada’s Fastest-Growing Companies by PROFIT Magazine!

-- 
Dr. Mark Wardle
Consultant Neurologist, University Hospital Wales, Cardiff, UK
Email: mark.war...@wales.nhs.uk or m...@wardle.org  Twitter: @mwardle
Telephone: 02920745274 (secretary) or facsimile: 02920744166





 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Changing from horizontal to single table inheritance

2013-10-04 Thread Chuck Hill
On 2013-10-04 11:06 AM, "Ramsey Gurley" wrote:

Not to contradict Chuck (he is always right),

Will someone PLEASE tell my wife?


--
Chuck Hill
Executive Managing Partner, VP Development and Technical Services

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects

Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing 
Companies in B.C!

Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of 
Canada’s Fastest-Growing Companies by PROFIT Magazine!
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Changing from horizontal to single table inheritance

2013-10-04 Thread Ramsey Gurley
On Oct 4, 2013, at 10:01 AM, Chuck Hill wrote:






Hi Mark,








On 2013-10-04 9:09 AM, "Mark Wardle" wrote:






Hi all,


When I originally planned the schema used for our clinical application, I used horizontal inheritance. As use has increased, I perceive that horizontal inheritance will not scale for more and more entities. Perhaps I should spend time measuring the performance
 impact, but I am planning on ever increasing the number of child entities (they act as data collection forms) and so I think single-table inheritance is a better fit.






Yes, it is.Not to contradict Chuck (he is always right), but how much data are you expecting?Specifically, if you are stuffing gigabytes of data into a single table you can get to the point where your table and/or indexes will no longer fit into memory. Once that happens, your performance falls off a cliff as it depends on the IO speed of the disks instead of RAM. When that happens, it is sudden and very unwelcome. To illustrate, you can see in this graph that somewhere between 30 and 45 GB, Postgresql 9.2.4 performance drops from handling 12000 selects per second to less than 3000. No surprise, this is on a new database with 48GB of memory.I think horizontal inheritance would have a natural advantage in the case where you have many gigabytes of data to store and you are generally fetching against only one of those tables. Ramsey







I have two questions.


1. Is there an easy way of migrating? I can see that I could set-up a wholly new type of entity / sub entities and then manually migrate old entity data into the new ones. This sounds like a considerable piece of work.





You should be able to migrate the model fairly painlessly.  For the data, I think you will end up with a script of INSERT INTO … VALUE SELECT FROM statements.







2. What happens in single-table inheritance if you have a clash of property names but the column name is different (or for that matter the same).





I think that should be OK.   EOs can't change entity type so EOF should do the right thing for each sub-entity in terms of moving data to and from the columns.


Chuck







-- 

Chuck Hill             
Executive Managing Partner, VP Development and Technical Services



Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/gvc/practical_webobjects


Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C! 

Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!





 ___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:https://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.comThis email sent to rgur...@smarthealth.com ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Changing from horizontal to single table inheritance

2013-10-04 Thread Chuck Hill
Hi Mark,


On 2013-10-04 9:09 AM, "Mark Wardle" wrote:

Hi all,

When I originally planned the schema used for our clinical application, I used 
horizontal inheritance. As use has increased, I perceive that horizontal 
inheritance will not scale for more and more entities. Perhaps I should spend 
time measuring the performance impact, but I am planning on ever increasing the 
number of child entities (they act as data collection forms) and so I think 
single-table inheritance is a better fit.

Yes, it is.


I have two questions.

1. Is there an easy way of migrating? I can see that I could set-up a wholly 
new type of entity / sub entities and then manually migrate old entity data 
into the new ones. This sounds like a considerable piece of work.

You should be able to migrate the model fairly painlessly.  For the data, I 
think you will end up with a script of INSERT INTO … VALUE SELECT FROM 
statements.


2. What happens in single-table inheritance if you have a clash of property 
names but the column name is different (or for that matter the same).

I think that should be OK.   EOs can't change entity type so EOF should do the 
right thing for each sub-entity in terms of moving data to and from the columns.

Chuck


--
Chuck Hill
Executive Managing Partner, VP Development and Technical Services

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects

Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing 
Companies in B.C!

Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of 
Canada’s Fastest-Growing Companies by PROFIT Magazine!
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Changing from horizontal to single table inheritance

2013-10-04 Thread Mark Wardle
Hi all,

When I originally planned the schema used for our clinical application, I used 
horizontal inheritance. As use has increased, I perceive that horizontal 
inheritance will not scale for more and more entities. Perhaps I should spend 
time measuring the performance impact, but I am planning on ever increasing the 
number of child entities (they act as data collection forms) and so I think 
single-table inheritance is a better fit.

I have two questions.

1. Is there an easy way of migrating? I can see that I could set-up a wholly 
new type of entity / sub entities and then manually migrate old entity data 
into the new ones. This sounds like a considerable piece of work.

2. What happens in single-table inheritance if you have a clash of property 
names but the column name is different (or for that matter the same).

Any advice much appreciated!

Mark

-- 
Dr. Mark Wardle
Consultant Neurologist, University Hospital Wales, Cardiff, UK
Email: mark.war...@wales.nhs.uk or m...@wardle.org  Twitter: @mwardle
Telephone: 02920745274 (secretary) or facsimile: 02920744166





 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: more on the Single Table Inheritance, the sql

2013-01-26 Thread James Cicenia
Is that a default? I need to read about that as this doesn't make sense to me.


On Jan 26, 2013, at 5:56 PM, Ramsey Gurley  wrote:

> 
> On Jan 26, 2013, at 1:36 PM, James Cicenia wrote:
> 
>> OK -
>> 
>> When I just the SQL...
>> 
>> It actually does three selects and not one.
>> It does a select for each of the children entities and then for the parent 
>> class.
>> 
>> Why? I am just asking or fetching the parentClass. Why does it want to also 
>> search by Qualifier of the subclasses?
> 
> EOFetchSpecification.setIsDeep
> 
>> 
>> Thanks
>> James
>> 
>> 
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/ramseygurley%40gmail.com
>> 
>> This email sent to ramseygur...@gmail.com
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Migrations create issue with single-table inheritance

2012-07-15 Thread Farrukh Ijaz
Can you confirm that the child entities are using the same Table Name? Can you 
share what is the error log on the console when migration fails? I've been 
using single table inheritance and so far didn't face any issues in migration.

Farrukh

On 2012-07-15, at 6:23 PM, Jesse Tayler  wrote:

> 
> last time I setup migrations, there were prototypes that failed, I just 
> cleaned up by hand I think -- what exactly is your error?
> 
> I doubt is has to do with your inheritance...
> 
> 
> On Jul 15, 2012, at 1:48 AM, "Mr. Robert Hanviriyapunt"  
> wrote:
> 
>> I was trying out Migrations just now with a model that has single-table 
>> inheritance.  I had some issues, namely that it choked on lines that added 
>> columns for the sub-entities.  Anyone have the same issue?  My work-around 
>> was to just move them to the parent entity before the create() is called.
>> 
>> = Robert =
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
>> 
>> This email sent to jtay...@oeinc.com
> 
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com
> 
> This email sent to farrukh.i...@fuegodigitalmedia.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Migrations create issue with single-table inheritance

2012-07-15 Thread Jesse Tayler

last time I setup migrations, there were prototypes that failed, I just cleaned 
up by hand I think -- what exactly is your error?

I doubt is has to do with your inheritance...


On Jul 15, 2012, at 1:48 AM, "Mr. Robert Hanviriyapunt"  
wrote:

> I was trying out Migrations just now with a model that has single-table 
> inheritance.  I had some issues, namely that it choked on lines that added 
> columns for the sub-entities.  Anyone have the same issue?  My work-around 
> was to just move them to the parent entity before the create() is called.
> 
> = Robert =
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
> 
> This email sent to jtay...@oeinc.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Migrations create issue with single-table inheritance

2012-07-14 Thread Johann Werner
Hi Robert,

I use single-table inheritance quite often but had never a problem with 
migrations. What are your issues? What is the code you are using for the 
migration? Did you generate it in Entity Modeler or did you write it by hand?

jw


Am 15.07.2012 um 07:48 schrieb Mr. Robert Hanviriyapunt:

> I was trying out Migrations just now with a model that has single-table 
> inheritance.  I had some issues, namely that it choked on lines that added 
> columns for the sub-entities.  Anyone have the same issue?  My work-around 
> was to just move them to the parent entity before the create() is called.
> 
> = Robert =



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Migrations create issue with single-table inheritance

2012-07-14 Thread Mr. Robert Hanviriyapunt
I was trying out Migrations just now with a model that has single-table 
inheritance.  I had some issues, namely that it choked on lines that added 
columns for the sub-entities.  Anyone have the same issue?  My work-around was 
to just move them to the parent entity before the create() is called.

= Robert =
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single Table Inheritance

2011-10-07 Thread Chuck Hill

On 2011-10-07, at 10:05 AM, Matteo Centro wrote:

> Thanks Chuck,
> 
> actually POI was not abstract nor there was a qualifier... Dumb me!

Good, I thought it was something simple!


> As this WOApp will have to "feed" an iOS app I was planning of using ERRest.
> I also verified that that ERRest, when asked for all POIs of a City, gives me 
> all the relevant attributes, even of Restaurants and Clubs, which is exactly 
> the thing I hoped to get with single table inheritance...WOW!

It is nice.

Chuck


> 
> Thanks,
> 
> Matteo
> 
> 
> On Fri, Oct 7, 2011 at 5:36 PM, Chuck Hill  wrote:
> Hi Matteo,
> 
> It sounds like something is not right in your model.  Check that
> - POI is either abstract or has a qualifier (e.g. qualifier type='P')
> - the Parent entity of Restaurant and Club is set, check that
> - the external (table) name of POI, Restaurant and Club is exactly identical
> 
> Chuck
> 
> On 2011-10-07, at 7:55 AM, Matteo Centro wrote:
> 
> > Hi all,
> >
> > kind of a stupid question but in my whole career with WO I never used 
> > Single Table Inheritance so I'm kind of a newbie here...
> >
> > I'll try to explain with a small example: I have an entity called 
> > PointOfInterest (POI), defined by the main attributes which are name, 
> > latitude, longitude, type and with a relationship to a City.
> > I then created two subclasses of POI
> > Restaurant (with qualifier type='R') and some more attributes
> > Club (with qualifier type='C') and some different attributes
> > All is mapped in two tables, one for City and one for POI. Everything 
> > looked fine in my head...
> >
> > I find puzzling though that if I ask a City for its POIs I get an array 
> > full of duplicates in this example I'm printing out all the POIs for a City:
> > POI name: Open POI Class: your.app.logic.Club
> > POI name: Jazz Club POI Class: your.app.logic.Club
> > POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> > POI name: Zushi POI Class: your.app.logic.Restaurant
> > POI name: Ristorante POI Class: your.app.logic.Restaurant
> > POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> > POI name: Zushi POI Class: your.app.logic.Restaurant
> > POI name: Open POI Class: your.app.logic.Club
> > POI name: Jazz Club POI Class: your.app.logic.Club
> > POI name: Generic poi POI Class: your.app.logic.PointOfInterest
> > POI name: Ristorante POI Class: your.app.logic.Restaurant
> >
> > In reality I only have 6 items in my POI table: 3 Restaurants, 2 Clubs and 
> > one row with blank type. So I was expecting of getting something like this:
> > POI name: Open POI Class: your.app.logic.Club
> > POI name: Jazz Club POI Class: your.app.logic.Club
> > POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> > POI name: Zushi POI Class: your.app.logic.Restaurant
> > POI name: Ristorante POI Class: your.app.logic.Restaurant
> > POI name: Generic poi POI Class: your.app.logic.PointOfInterest
> >
> > Maybe I'm approaching the problem in the stupidest way but I'd like to 
> > understand a little bit more about what you guys think...
> >
> > Thanks,
> >
> >
> > Matteo
> >
> > ___
> > Do not post admin requests to the list. They will be ignored.
> > Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> >
> > This email sent to ch...@global-village.net
> 
> --
> Chuck Hill Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 
> 

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single Table Inheritance

2011-10-07 Thread Matteo Centro
Thanks Chuck,

actually POI was not abstract nor there was a qualifier... Dumb me!

As this WOApp will have to "feed" an iOS app I was planning of using ERRest.
I also verified that that ERRest, when asked for all POIs of a City, gives
me all the relevant attributes, even of Restaurants and Clubs, which is
exactly the thing I hoped to get with single table inheritance...WOW!

Thanks,

Matteo


On Fri, Oct 7, 2011 at 5:36 PM, Chuck Hill  wrote:

> Hi Matteo,
>
> It sounds like something is not right in your model.  Check that
> - POI is either abstract or has a qualifier (e.g. qualifier type='P')
> - the Parent entity of Restaurant and Club is set, check that
> - the external (table) name of POI, Restaurant and Club is exactly
> identical
>
> Chuck
>
> On 2011-10-07, at 7:55 AM, Matteo Centro wrote:
>
> > Hi all,
> >
> > kind of a stupid question but in my whole career with WO I never used
> Single Table Inheritance so I'm kind of a newbie here...
> >
> > I'll try to explain with a small example: I have an entity called
> PointOfInterest (POI), defined by the main attributes which are name,
> latitude, longitude, type and with a relationship to a City.
> > I then created two subclasses of POI
> > Restaurant (with qualifier type='R') and some more attributes
> > Club (with qualifier type='C') and some different attributes
> > All is mapped in two tables, one for City and one for POI. Everything
> looked fine in my head...
> >
> > I find puzzling though that if I ask a City for its POIs I get an array
> full of duplicates in this example I'm printing out all the POIs for a City:
> > POI name: Open POI Class: your.app.logic.Club
> > POI name: Jazz Club POI Class: your.app.logic.Club
> > POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> > POI name: Zushi POI Class: your.app.logic.Restaurant
> > POI name: Ristorante POI Class: your.app.logic.Restaurant
> > POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> > POI name: Zushi POI Class: your.app.logic.Restaurant
> > POI name: Open POI Class: your.app.logic.Club
> > POI name: Jazz Club POI Class: your.app.logic.Club
> > POI name: Generic poi POI Class: your.app.logic.PointOfInterest
> > POI name: Ristorante POI Class: your.app.logic.Restaurant
> >
> > In reality I only have 6 items in my POI table: 3 Restaurants, 2 Clubs
> and one row with blank type. So I was expecting of getting something like
> this:
> > POI name: Open POI Class: your.app.logic.Club
> > POI name: Jazz Club POI Class: your.app.logic.Club
> > POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> > POI name: Zushi POI Class: your.app.logic.Restaurant
> > POI name: Ristorante POI Class: your.app.logic.Restaurant
> > POI name: Generic poi POI Class: your.app.logic.PointOfInterest
> >
> > Maybe I'm approaching the problem in the stupidest way but I'd like to
> understand a little bit more about what you guys think...
> >
> > Thanks,
> >
> >
> > Matteo
> >
> > ___
> > Do not post admin requests to the list. They will be ignored.
> > Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> > Help/Unsubscribe/Update your Subscription:
> >
> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> >
> > This email sent to ch...@global-village.net
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>
>
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single Table Inheritance

2011-10-07 Thread Chuck Hill
Hi Matteo,

It sounds like something is not right in your model.  Check that 
- POI is either abstract or has a qualifier (e.g. qualifier type='P')
- the Parent entity of Restaurant and Club is set, check that 
- the external (table) name of POI, Restaurant and Club is exactly identical

Chuck

On 2011-10-07, at 7:55 AM, Matteo Centro wrote:

> Hi all,
> 
> kind of a stupid question but in my whole career with WO I never used Single 
> Table Inheritance so I'm kind of a newbie here...
> 
> I'll try to explain with a small example: I have an entity called 
> PointOfInterest (POI), defined by the main attributes which are name, 
> latitude, longitude, type and with a relationship to a City.
> I then created two subclasses of POI
> Restaurant (with qualifier type='R') and some more attributes
> Club (with qualifier type='C') and some different attributes
> All is mapped in two tables, one for City and one for POI. Everything looked 
> fine in my head...
> 
> I find puzzling though that if I ask a City for its POIs I get an array full 
> of duplicates in this example I'm printing out all the POIs for a City:
> POI name: Open POI Class: your.app.logic.Club
> POI name: Jazz Club POI Class: your.app.logic.Club
> POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> POI name: Zushi POI Class: your.app.logic.Restaurant
> POI name: Ristorante POI Class: your.app.logic.Restaurant
> POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> POI name: Zushi POI Class: your.app.logic.Restaurant
> POI name: Open POI Class: your.app.logic.Club
> POI name: Jazz Club POI Class: your.app.logic.Club
> POI name: Generic poi POI Class: your.app.logic.PointOfInterest
> POI name: Ristorante POI Class: your.app.logic.Restaurant
> 
> In reality I only have 6 items in my POI table: 3 Restaurants, 2 Clubs and 
> one row with blank type. So I was expecting of getting something like this:
> POI name: Open POI Class: your.app.logic.Club
> POI name: Jazz Club POI Class: your.app.logic.Club
> POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> POI name: Zushi POI Class: your.app.logic.Restaurant
> POI name: Ristorante POI Class: your.app.logic.Restaurant
> POI name: Generic poi POI Class: your.app.logic.PointOfInterest
> 
> Maybe I'm approaching the problem in the stupidest way but I'd like to 
> understand a little bit more about what you guys think...
> 
> Thanks,
> 
> 
> Matteo
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> 
> This email sent to ch...@global-village.net

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Single Table Inheritance

2011-10-07 Thread Matteo Centro
Hi all,

kind of a stupid question but in my whole career with WO I never used Single
Table Inheritance so I'm kind of a newbie here...

I'll try to explain with a small example: I have an entity called
PointOfInterest (POI), defined by the main attributes which
are name, latitude, longitude, type and with a relationship to a City.
I then created two subclasses of POI
Restaurant (with qualifier type='R') and some more attributes
Club (with qualifier type='C') and some different attributes
All is mapped in two tables, one for City and one for POI. Everything looked
fine in my head...

I find puzzling though that if I ask a City for its POIs I get an array full
of duplicates in this example I'm printing out all the POIs for a City:

POI name: Open POI Class: your.app.logic.Club

POI name: Jazz Club POI Class: your.app.logic.Club

POI name: Dal Baffo POI Class: your.app.logic.Restaurant

POI name: Zushi POI Class: your.app.logic.Restaurant

POI name: Ristorante POI Class: your.app.logic.Restaurant

POI name: Dal Baffo POI Class: your.app.logic.Restaurant

POI name: Zushi POI Class: your.app.logic.Restaurant

POI name: Open POI Class: your.app.logic.Club

POI name: Jazz Club POI Class: your.app.logic.Club

POI name: Generic poi POI Class: your.app.logic.PointOfInterest

POI name: Ristorante POI Class: your.app.logic.Restaurant

In reality I only have 6 items in my POI table: 3 Restaurants, 2 Clubs and
one row with blank type. So I was expecting of getting something like this:

POI name: Open POI Class: your.app.logic.Club

POI name: Jazz Club POI Class: your.app.logic.Club

POI name: Dal Baffo POI Class: your.app.logic.Restaurant

POI name: Zushi POI Class: your.app.logic.Restaurant

POI name: Ristorante POI Class: your.app.logic.Restaurant

POI name: Generic poi POI Class: your.app.logic.PointOfInterest


Maybe I'm approaching the problem in the stupidest way but I'd like to
understand a little bit more about what you guys think...

Thanks,


Matteo
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Reworking Vertical to Single Table Inheritance help

2010-09-23 Thread William Hatch
Thanks David,

Very weird; it worked in Openbase just fine with the missing record, which, 
sure enough was the problem. Now, this process that I was talking about only 
involves new objects, product, invoice and user in this case are all new. Must 
have been trying to get faulted in for some reason. Thanks again; very much 
appreciated. 

Bill


On Sep 23, 2010, at 5:37 PM, David Avendasora wrote:

> Hi Bill,
> 
> That error simply means that a foreign key (5926) in a table  can't be found 
> in the primary key of the related table (User), but since you don't have a 
> true foreign key constraint in the database, it is left to EOF to stumble 
> across it.
> 
> I'd look in your invoice table for a record that has 5926 as the User ID 
> value.
> 
> The first thing I'd do is add foreign key constraints to the database. They 
> keep other non-EOF things honest. 
> 
> Dave
> 
> Sent from my iPad
> 
> On Sep 23, 2010, at 5:08 PM, William Hatch  wrote:
> 
>> Inherited a project where a few entities had been implementing vertical 
>> inheritance. Part of the rework was moving from openbase to postrges, and 
>> doing some additional cleanup. 
>> 
>> Anyway, after migrating all the data, and without changing the inheritance 
>> modeling at all, I was getting this error:
>> 
>> The object with globalID _EOIntegralKeyGlobalID[User 
>> (java.lang.Integer)5926] could not be found in the database. This could be 
>> result of a referential integrity problem with the database. An empty fault 
>> could not be created because the object's class could not be determined 
>> (e.g. the GID is temporary or it is for an abstract entity).
>> 
>> At first I thought I may have done something wrong when resetting the pk 
>> sequences in postgres after the migration, and given that we were using 
>> vertical inheritance, with four different tables, it was likely that may 
>> have been causing some issues. So I created a new single table, consolidated 
>> all the original four tables into the new table, and then changed the table 
>> of the base abstract entity to point to the new all in one table. Still got 
>> the same error. I'm still glad I did it though; I didn't see any possible 
>> reason for using vertical save for having to relax a few existing 
>> constraints that I could handle at the app layer. I am able to CRUD on all 
>> the existing EO's that are part of the old vertical design, after moving to 
>> the single table model. But there's one area that is failing, where the 
>> above exception is coming from. I've got:
>> 
>> Invoices ->> Products
>> 
>> Invoices -> Users (base abstract entity of the inheritance model) mandatory 
>> not null, and delete rule is nullify
>> 
>> Products -> Invoice
>> 
>> 
>> and we're blowing up when setting a product onto the invoice. 
>> 
>> Am I right in thinking that maybe I want to change the relationship from 
>> Invoices to Users to be Invoices -> Clients, and make it optional in the 
>> model? A potentially large wrinkle with that is that another of the 
>> inherited entities also has a relationship to Invoices, and Invoices to it, 
>> also pointing to the abstract User entity. Pointers or suggestions? Thanks.
>> 
>> Bill
>> 
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com
>> 
>> This email sent to webobje...@avendasora.com
>> 
>> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Reworking Vertical to Single Table Inheritance help

2010-09-23 Thread Ken Anderson
Bill,

I'm guessing that User is part of the inheritance tree that you switched from 
Vertical to Single Table.  Is 5926 a valid primary key?

Ken

On Sep 23, 2010, at 5:08 PM, William Hatch wrote:

> Inherited a project where a few entities had been implementing vertical 
> inheritance. Part of the rework was moving from openbase to postrges, and 
> doing some additional cleanup. 
> 
> Anyway, after migrating all the data, and without changing the inheritance 
> modeling at all, I was getting this error:
> 
> The object with globalID _EOIntegralKeyGlobalID[User (java.lang.Integer)5926] 
> could not be found in the database. This could be result of a referential 
> integrity problem with the database. An empty fault could not be created 
> because the object's class could not be determined (e.g. the GID is temporary 
> or it is for an abstract entity).
> 
> At first I thought I may have done something wrong when resetting the pk 
> sequences in postgres after the migration, and given that we were using 
> vertical inheritance, with four different tables, it was likely that may have 
> been causing some issues. So I created a new single table, consolidated all 
> the original four tables into the new table, and then changed the table of 
> the base abstract entity to point to the new all in one table. Still got the 
> same error. I'm still glad I did it though; I didn't see any possible reason 
> for using vertical save for having to relax a few existing constraints that I 
> could handle at the app layer. I am able to CRUD on all the existing EO's 
> that are part of the old vertical design, after moving to the single table 
> model. But there's one area that is failing, where the above exception is 
> coming from. I've got:
> 
> Invoices ->> Products
> 
> Invoices -> Users (base abstract entity of the inheritance model) mandatory 
> not null, and delete rule is nullify
> 
> Products -> Invoice
> 
> 
> and we're blowing up when setting a product onto the invoice. 
> 
> Am I right in thinking that maybe I want to change the relationship from 
> Invoices to Users to be Invoices -> Clients, and make it optional in the 
> model? A potentially large wrinkle with that is that another of the inherited 
> entities also has a relationship to Invoices, and Invoices to it, also 
> pointing to the abstract User entity. Pointers or suggestions? Thanks.
> 
> Bill
> 
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/kenlists%40anderhome.com
> 
> This email sent to kenli...@anderhome.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Reworking Vertical to Single Table Inheritance help

2010-09-23 Thread David Avendasora
Hi Bill,

That error simply means that a foreign key (5926) in a table  can't be found in 
the primary key of the related table (User), but since you don't have a true 
foreign key constraint in the database, it is left to EOF to stumble across it.

I'd look in your invoice table for a record that has 5926 as the User ID value.

The first thing I'd do is add foreign key constraints to the database. They 
keep other non-EOF things honest. 

Dave

Sent from my iPad

On Sep 23, 2010, at 5:08 PM, William Hatch  wrote:

> Inherited a project where a few entities had been implementing vertical 
> inheritance. Part of the rework was moving from openbase to postrges, and 
> doing some additional cleanup. 
> 
> Anyway, after migrating all the data, and without changing the inheritance 
> modeling at all, I was getting this error:
> 
> The object with globalID _EOIntegralKeyGlobalID[User (java.lang.Integer)5926] 
> could not be found in the database. This could be result of a referential 
> integrity problem with the database. An empty fault could not be created 
> because the object's class could not be determined (e.g. the GID is temporary 
> or it is for an abstract entity).
> 
> At first I thought I may have done something wrong when resetting the pk 
> sequences in postgres after the migration, and given that we were using 
> vertical inheritance, with four different tables, it was likely that may have 
> been causing some issues. So I created a new single table, consolidated all 
> the original four tables into the new table, and then changed the table of 
> the base abstract entity to point to the new all in one table. Still got the 
> same error. I'm still glad I did it though; I didn't see any possible reason 
> for using vertical save for having to relax a few existing constraints that I 
> could handle at the app layer. I am able to CRUD on all the existing EO's 
> that are part of the old vertical design, after moving to the single table 
> model. But there's one area that is failing, where the above exception is 
> coming from. I've got:
> 
> Invoices ->> Products
> 
> Invoices -> Users (base abstract entity of the inheritance model) mandatory 
> not null, and delete rule is nullify
> 
> Products -> Invoice
> 
> 
> and we're blowing up when setting a product onto the invoice. 
> 
> Am I right in thinking that maybe I want to change the relationship from 
> Invoices to Users to be Invoices -> Clients, and make it optional in the 
> model? A potentially large wrinkle with that is that another of the inherited 
> entities also has a relationship to Invoices, and Invoices to it, also 
> pointing to the abstract User entity. Pointers or suggestions? Thanks.
> 
> Bill
> 
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com
> 
> This email sent to webobje...@avendasora.com
> 
> 
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Reworking Vertical to Single Table Inheritance help

2010-09-23 Thread William Hatch
Inherited a project where a few entities had been implementing vertical 
inheritance. Part of the rework was moving from openbase to postrges, and doing 
some additional cleanup. 

Anyway, after migrating all the data, and without changing the inheritance 
modeling at all, I was getting this error:

The object with globalID _EOIntegralKeyGlobalID[User (java.lang.Integer)5926] 
could not be found in the database. This could be result of a referential 
integrity problem with the database. An empty fault could not be created 
because the object's class could not be determined (e.g. the GID is temporary 
or it is for an abstract entity).

At first I thought I may have done something wrong when resetting the pk 
sequences in postgres after the migration, and given that we were using 
vertical inheritance, with four different tables, it was likely that may have 
been causing some issues. So I created a new single table, consolidated all the 
original four tables into the new table, and then changed the table of the base 
abstract entity to point to the new all in one table. Still got the same error. 
I'm still glad I did it though; I didn't see any possible reason for using 
vertical save for having to relax a few existing constraints that I could 
handle at the app layer. I am able to CRUD on all the existing EO's that are 
part of the old vertical design, after moving to the single table model. But 
there's one area that is failing, where the above exception is coming from. 
I've got:

Invoices ->> Products

Invoices -> Users (base abstract entity of the inheritance model) mandatory not 
null, and delete rule is nullify

Products -> Invoice


and we're blowing up when setting a product onto the invoice. 

Am I right in thinking that maybe I want to change the relationship from 
Invoices to Users to be Invoices -> Clients, and make it optional in the model? 
A potentially large wrinkle with that is that another of the inherited entities 
also has a relationship to Invoices, and Invoices to it, also pointing to the 
abstract User entity. Pointers or suggestions? Thanks.

Bill


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single Table Inheritance and Multiple Queries SOLVED

2010-07-19 Thread Jeffrey Simpson
Just wanted to send this to the list so someone could use the info in the 
future.

The problem turned out to be one of the sub entities had a complex qualifier.  
The qualifier before the fix was "((type <> 7) and (type <> 111) and (type <> 
112) and (type <> 8) and (type <> 20)) " and the fixed version was "type = 1"



Jeffrey Simpson
Senior Software Engineer
Telephone: 240.235.2144
Fax: 240.235.2174

Youth For Understanding (YFU) prepares young people for their responsibilities 
and opportunities in a changing, interdependent world. simp...@yfu.orgon Jul 
13, 2010, at 11:54 AM, Chuck Hill wrote:

> Check that ALL of the entities in that hierarchy use the exact same table 
> name.
>
> Chuck
>
> On Jul 13, 2010, at 7:51 AM, Jeffrey Simpson wrote:
>
>> WebObjects version = 5.4.3
>>
>> I took a closer look.  It seems to be happening only on one Entity 
>> hierarchy.  It was real noticeable on that hierarchy since it was the most 
>> subclassed.  The other hierarchies seem to only query once.  Now I need to 
>> figure out why.
>>
>>
>>
>>
>> Jeffrey Simpson
>> Senior Software Engineer
>> Telephone: 240.235.2144
>> Fax: 240.235.2174
>>
>> Youth For Understanding (YFU) prepares young people for their 
>> responsibilities and opportunities in a changing, interdependent world. 
>> simp...@yfu.orgon Jul 12, 2010, at 5:05 PM, Chuck Hill wrote:
>>
>>> Which version of WO?  I thought it would not do this if everything in the 
>>> inheritance hierarchy was in the same table.
>>>
>>>
>>> Chuck
>>>
>>>
>>> On Jul 12, 2010, at 7:39 AM, Jeffrey Simpson wrote:
>>>
>>>> We have a number of entities that use single table inheritance.  When a 
>>>> relationship points to the parent entity it does a separate fetch for each 
>>>> child entity.  I know this is how the inheritance was designed originally. 
>>>>  Has anything been done so that it does on query and applies the qualifier 
>>>> in memory to determine the entity type?  I want to make sure I am no 
>>>> missing something.
>>>>
>>>>
>>>>
>>>> Jeffrey Simpson
>>>> Senior Software Engineer
>>>> Telephone: 240.235.2144
>>>> Fax: 240.235.2174
>>>> simp...@yfu.org
>>>>
>>>> Youth For Understanding (YFU) prepares young people for their 
>>>> responsibilities and opportunities in a changing, interdependent world.
>>>> ___
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>>>>
>>>> This email sent to ch...@global-village.net
>>>
>>> --
>>> Chuck Hill Senior Consultant / VP Development
>>>
>>> Practical WebObjects - for developers who want to increase their overall 
>>> knowledge of WebObjects or who are trying to solve specific problems.
>>> http://www.global-village.net/products/practical_webobjects
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single Table Inheritance and Multiple Queries

2010-07-13 Thread Jon Nolan
And all attributes across all entities match and use the exact same 
column names.


On 7/13/10 9:54 AM, Chuck Hill wrote:

Check that ALL of the entities in that hierarchy use the exact same table name.

Chuck

On Jul 13, 2010, at 7:51 AM, Jeffrey Simpson wrote:


WebObjects version = 5.4.3

I took a closer look.  It seems to be happening only on one Entity hierarchy.  
It was real noticeable on that hierarchy since it was the most subclassed.  The 
other hierarchies seem to only query once.  Now I need to figure out why.




Jeffrey Simpson
Senior Software Engineer
Telephone: 240.235.2144
Fax: 240.235.2174

Youth For Understanding (YFU) prepares young people for their responsibilities 
and opportunities in a changing, interdependent world. simp...@yfu.orgon Jul 
12, 2010, at 5:05 PM, Chuck Hill wrote:


Which version of WO?  I thought it would not do this if everything in the 
inheritance hierarchy was in the same table.


Chuck


On Jul 12, 2010, at 7:39 AM, Jeffrey Simpson wrote:


We have a number of entities that use single table inheritance.  When a 
relationship points to the parent entity it does a separate fetch for each 
child entity.  I know this is how the inheritance was designed originally.  Has 
anything been done so that it does on query and applies the qualifier in memory 
to determine the entity type?  I want to make sure I am no missing something.



Jeffrey Simpson
Senior Software Engineer
Telephone: 240.235.2144
Fax: 240.235.2174
simp...@yfu.org

Youth For Understanding (YFU) prepares young people for their responsibilities 
and opportunities in a changing, interdependent world.
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to ch...@global-village.net


--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects














  ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/lists%40lochgarman.com

This email sent to li...@lochgarman.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single Table Inheritance and Multiple Queries

2010-07-13 Thread Chuck Hill
Check that ALL of the entities in that hierarchy use the exact same table name.

Chuck

On Jul 13, 2010, at 7:51 AM, Jeffrey Simpson wrote:

> WebObjects version = 5.4.3
> 
> I took a closer look.  It seems to be happening only on one Entity hierarchy. 
>  It was real noticeable on that hierarchy since it was the most subclassed.  
> The other hierarchies seem to only query once.  Now I need to figure out why.
> 
> 
> 
> 
> Jeffrey Simpson
> Senior Software Engineer
> Telephone: 240.235.2144
> Fax: 240.235.2174
> 
> Youth For Understanding (YFU) prepares young people for their 
> responsibilities and opportunities in a changing, interdependent world. 
> simp...@yfu.orgon Jul 12, 2010, at 5:05 PM, Chuck Hill wrote:
> 
>> Which version of WO?  I thought it would not do this if everything in the 
>> inheritance hierarchy was in the same table.
>> 
>> 
>> Chuck
>> 
>> 
>> On Jul 12, 2010, at 7:39 AM, Jeffrey Simpson wrote:
>> 
>>> We have a number of entities that use single table inheritance.  When a 
>>> relationship points to the parent entity it does a separate fetch for each 
>>> child entity.  I know this is how the inheritance was designed originally.  
>>> Has anything been done so that it does on query and applies the qualifier 
>>> in memory to determine the entity type?  I want to make sure I am no 
>>> missing something.
>>> 
>>> 
>>> 
>>> Jeffrey Simpson
>>> Senior Software Engineer
>>> Telephone: 240.235.2144
>>> Fax: 240.235.2174
>>> simp...@yfu.org
>>> 
>>> Youth For Understanding (YFU) prepares young people for their 
>>> responsibilities and opportunities in a changing, interdependent world.
>>> ___
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>>> 
>>> This email sent to ch...@global-village.net
>> 
>> --
>> Chuck Hill Senior Consultant / VP Development
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/products/practical_webobjects
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Single Table Inheritance and Multiple Queries

2010-07-13 Thread Jeffrey Simpson
WebObjects version = 5.4.3

I took a closer look.  It seems to be happening only on one Entity hierarchy.  
It was real noticeable on that hierarchy since it was the most subclassed.  The 
other hierarchies seem to only query once.  Now I need to figure out why.




Jeffrey Simpson
Senior Software Engineer
Telephone: 240.235.2144
Fax: 240.235.2174

Youth For Understanding (YFU) prepares young people for their responsibilities 
and opportunities in a changing, interdependent world. simp...@yfu.orgon Jul 
12, 2010, at 5:05 PM, Chuck Hill wrote:

> Which version of WO?  I thought it would not do this if everything in the 
> inheritance hierarchy was in the same table.
>
>
> Chuck
>
>
> On Jul 12, 2010, at 7:39 AM, Jeffrey Simpson wrote:
>
>> We have a number of entities that use single table inheritance.  When a 
>> relationship points to the parent entity it does a separate fetch for each 
>> child entity.  I know this is how the inheritance was designed originally.  
>> Has anything been done so that it does on query and applies the qualifier in 
>> memory to determine the entity type?  I want to make sure I am no missing 
>> something.
>>
>>
>>
>> Jeffrey Simpson
>> Senior Software Engineer
>> Telephone: 240.235.2144
>> Fax: 240.235.2174
>> simp...@yfu.org
>>
>> Youth For Understanding (YFU) prepares young people for their 
>> responsibilities and opportunities in a changing, interdependent world.
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>>
>> This email sent to ch...@global-village.net
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single Table Inheritance and Multiple Queries

2010-07-12 Thread Chuck Hill
Which version of WO?  I thought it would not do this if everything in the 
inheritance hierarchy was in the same table.


Chuck


On Jul 12, 2010, at 7:39 AM, Jeffrey Simpson wrote:

> We have a number of entities that use single table inheritance.  When a 
> relationship points to the parent entity it does a separate fetch for each 
> child entity.  I know this is how the inheritance was designed originally.  
> Has anything been done so that it does on query and applies the qualifier in 
> memory to determine the entity type?  I want to make sure I am no missing 
> something.
> 
> 
> 
> Jeffrey Simpson
> Senior Software Engineer
> Telephone: 240.235.2144
> Fax: 240.235.2174
> simp...@yfu.org
> 
> Youth For Understanding (YFU) prepares young people for their 
> responsibilities and opportunities in a changing, interdependent world.
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> 
> This email sent to ch...@global-village.net

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Single Table Inheritance and Multiple Queries

2010-07-12 Thread Jeffrey Simpson
We have a number of entities that use single table inheritance.  When a 
relationship points to the parent entity it does a separate fetch for each 
child entity.  I know this is how the inheritance was designed originally.  Has 
anything been done so that it does on query and applies the qualifier in memory 
to determine the entity type?  I want to make sure I am no missing something.



Jeffrey Simpson
Senior Software Engineer
Telephone: 240.235.2144
Fax: 240.235.2174
simp...@yfu.org

Youth For Understanding (YFU) prepares young people for their responsibilities 
and opportunities in a changing, interdependent world.
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an entity be promoted in single table inheritance?

2010-04-02 Thread Kieran Kelleher
Hi Mark,

I favor using an INT to identify the type and I use Properties entries to map 
to java classes, like shown below. 

CampaignBehaviour.10 = wk.cheetah.eof.JobsiteRadiusCampaignBehaviour
CampaignBehaviour.70 = wk.cheetah.eof.BirthdayRadiusCampaignBehaviour
CampaignBehaviour.80 = wk.cheetah.eof.B2bCampaignBehaviour
CampaignBehaviour.90 = wk.cheetah.eof.NewMoverCampaignBehaviour
CampaignBehaviour.110 = wk.cheetah.eof.MyMailshopCampaignBehaviour

I use a convention of . and lazily construct the 
behaviour class internal to the EO instance. So for replacement of traditional 
inheritance or for refactoring existing single-table inheritance into a single 
entity with behaviours, I might typically start with one behaviour and use the 
existing 'type' values that exist in the db table. However you can obviously 
have multiple behaviours mapped to multiple attributes.

For me, this has made my life easy, and adding new behaviours is as easy as 
adding a new class and a new property - no eomodel or schema changes.

-Kieran





On Apr 2, 2010, at 3:13 AM, Mark Wardle wrote:

> (the reason I ask is that I find myself needing to select different java 
> logic depending on instance - with a reference to the logic class generated 
> (lazily) based on the class name as stored in the database. I've always 
> wondered whether there is a better way.?)
> 
> B/w mark
> 
> -- 
> Dr. Mark Wardle
> Specialist registrar, Neurology
> (Sent from my mobile)
> 
> 
> On 1 Apr 2010, at 13:54, Mark Wardle  wrote:
> 
>> Hi Kieran,
>> 
>> Do you store the name of the java class or use a lookup hashmap or
>> something else?
>> 
>> Mark
>> 
>> On 1 April 2010 11:52, Kieran Kelleher  wrote:
>>> For sure, Roles are the way to go, especially if someone can have more than 
>>> one Role (outside of the game of Chess, can a King also be a Knight? ;-) ) 
>>> However if your design really has only one Role and you don't want to or 
>>> can't change your database schema, you could drop the inheritance on those 
>>> entities and use the Strategy Design pattern to lazily instantiate 
>>> composited behaviours  PeasantBehaviour, KingBehaviour, KnightBehaviour 
>>> that all implement the RoleBehaviour interface (in American english, drop 
>>> the 'u' in "behaviour".) You don't even need to change the current 
>>> database. Just use the current inheritance 'type' field to map to a 
>>> RoleBehaviour class. and now the RoleBehaviour becomes an attribute. 
>>> The work involved is just EOModel simplification and breaking out the 
>>> behaviours into classes
>>> 
>>> YMMV, Kieran
>>> 
>>> 
>>> On Mar 31, 2010, at 10:48 PM, Ramsey Lee Gurley wrote:
>>> 
>>>> I can't see this being possible in Vertical or Horizontal, but with single 
>>>> table... could the qualifying attribute be updated to 'promote' an entity 
>>>> to a new class?  Let's say we have we have an abstract Person entity with 
>>>> three subclasses, Peasant, Knight, King.  If I wanted to promote a knight 
>>>> to king, is it possible to simply update my type attribute from knight to 
>>>> king and EOF will start treating that record as a king instead of a 
>>>> knight?  I would assume I would need to invalidate the existing knight 
>>>> object after saving changes so it could be refetched as a king... and if I 
>>>> had multiple instances, I'd need to invalidate it in those instances 
>>>> too... but is it possible?  Or will EOF just flip out in the saveChanges() 
>>>> and refuse to do it?
>>>> 
>>>> Just an academic question, of course (^_^)
>>>> 
>>>> Ramsey ___
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com
>>>> 
>>>> This email sent to kieran_li...@mac.com
>>> 
>>> ___
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/webobjects-dev/mark%40wardle.org
>>> 
>>> This email sent to m...@wardle.org
>>> 
>>> 
>> 
>> 
>> 
>> -- 
>> Dr. Mark Wardle
>> Specialist registrar, Neurology
>> Cardiff, UK

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an entity be promoted in single table inheritance?

2010-04-02 Thread Mark Wardle
(the reason I ask is that I find myself needing to select different  
java logic depending on instance - with a reference to the logic class  
generated (lazily) based on the class name as stored in the database.  
I've always wondered whether there is a better way.?)


B/w mark

--
Dr. Mark Wardle
Specialist registrar, Neurology
(Sent from my mobile)


On 1 Apr 2010, at 13:54, Mark Wardle  wrote:


Hi Kieran,

Do you store the name of the java class or use a lookup hashmap or
something else?

Mark

On 1 April 2010 11:52, Kieran Kelleher  wrote:
For sure, Roles are the way to go, especially if someone can have  
more than one Role (outside of the game of Chess, can a King also  
be a Knight? ;-) ) However if your design really has only one Role  
and you don't want to or can't change your database schema, you  
could drop the inheritance on those entities and use the Strategy  
Design pattern to lazily instantiate composited behaviours   
PeasantBehaviour, KingBehaviour, KnightBehaviour that all implement  
the RoleBehaviour interface (in American english, drop the 'u' in  
"behaviour".) You don't even need to change the current database.  
Just use the current inheritance 'type' field to map to a  
RoleBehaviour class. and now the RoleBehaviour becomes an  
attribute. The work involved is just EOModel simplification and  
breaking out the behaviours into classes


YMMV, Kieran


On Mar 31, 2010, at 10:48 PM, Ramsey Lee Gurley wrote:

I can't see this being possible in Vertical or Horizontal, but  
with single table... could the qualifying attribute be updated to  
'promote' an entity to a new class?  Let's say we have we have an  
abstract Person entity with three subclasses, Peasant, Knight,  
King.  If I wanted to promote a knight to king, is it possible to  
simply update my type attribute from knight to king and EOF will  
start treating that record as a king instead of a knight?  I would  
assume I would need to invalidate the existing knight object after  
saving changes so it could be refetched as a king... and if I had  
multiple instances, I'd need to invalidate it in those instances  
too... but is it possible?  Or will EOF just flip out in the  
saveChanges() and refuse to do it?


Just an academic question, of course (^_^)

Ramsey ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com

This email sent to kieran_li...@mac.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mark%40wardle.org

This email sent to m...@wardle.org






--
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an entity be promoted in single table inheritance?

2010-04-01 Thread Mark Wardle
Hi Kieran,

Do you store the name of the java class or use a lookup hashmap or
something else?

Mark

On 1 April 2010 11:52, Kieran Kelleher  wrote:
> For sure, Roles are the way to go, especially if someone can have more than 
> one Role (outside of the game of Chess, can a King also be a Knight? ;-) ) 
> However if your design really has only one Role and you don't want to or 
> can't change your database schema, you could drop the inheritance on those 
> entities and use the Strategy Design pattern to lazily instantiate composited 
> behaviours  PeasantBehaviour, KingBehaviour, KnightBehaviour that all 
> implement the RoleBehaviour interface (in American english, drop the 'u' in 
> "behaviour".) You don't even need to change the current database. Just use 
> the current inheritance 'type' field to map to a RoleBehaviour class. and 
> now the RoleBehaviour becomes an attribute. The work involved is just EOModel 
> simplification and breaking out the behaviours into classes
>
> YMMV, Kieran
>
>
> On Mar 31, 2010, at 10:48 PM, Ramsey Lee Gurley wrote:
>
>> I can't see this being possible in Vertical or Horizontal, but with single 
>> table... could the qualifying attribute be updated to 'promote' an entity to 
>> a new class?  Let's say we have we have an abstract Person entity with three 
>> subclasses, Peasant, Knight, King.  If I wanted to promote a knight to king, 
>> is it possible to simply update my type attribute from knight to king and 
>> EOF will start treating that record as a king instead of a knight?  I would 
>> assume I would need to invalidate the existing knight object after saving 
>> changes so it could be refetched as a king... and if I had multiple 
>> instances, I'd need to invalidate it in those instances too... but is it 
>> possible?  Or will EOF just flip out in the saveChanges() and refuse to do 
>> it?
>>
>> Just an academic question, of course (^_^)
>>
>> Ramsey ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com
>>
>> This email sent to kieran_li...@mac.com
>
>  ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/mark%40wardle.org
>
> This email sent to m...@wardle.org
>
>



-- 
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an entity be promoted in single table inheritance?

2010-04-01 Thread Ramsey Lee Gurley
I suspected as much, but I was curious and had to ask (^_^)

Thanks to everyone for the replies!

Ramsey


On Mar 31, 2010, at 10:54 PM, Chuck Hill wrote:

> 
> On Mar 31, 2010, at 7:48 PM, Ramsey Lee Gurley wrote:
> 
>> I can't see this being possible in Vertical or Horizontal, but with single 
>> table... could the qualifying attribute be updated to 'promote' an entity to 
>> a new class?
> 
> F**k No!
> 
> Do NOT try this.  Use the Role pattern or something that won't make EOF 
> insane.
> 
> 
> 
>> Let's say we have we have an abstract Person entity with three subclasses, 
>> Peasant, Knight, King.  If I wanted to promote a knight to king, is it 
>> possible to simply update my type attribute from knight to king and EOF will 
>> start treating that record as a king instead of a knight?  I would assume I 
>> would need to invalidate the existing knight object after saving changes so 
>> it could be refetched as a king... and if I had multiple instances, I'd need 
>> to invalidate it in those instances too... but is it possible?  Or will EOF 
>> just flip out in the saveChanges() and refuse to do it?
>> 
>> Just an academic question, of course (^_^)
> 
> 
> You could mybe get it to work if you invalidated enough things.  But, 
> really, do you want hair on your palms?
> 
> 
> Chuck
> 
> 
> -- 
> Chuck Hill Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 



smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Can an entity be promoted in single table inheritance?

2010-04-01 Thread Kieran Kelleher
For sure, Roles are the way to go, especially if someone can have more than one 
Role (outside of the game of Chess, can a King also be a Knight? ;-) ) However 
if your design really has only one Role and you don't want to or can't change 
your database schema, you could drop the inheritance on those entities and use 
the Strategy Design pattern to lazily instantiate composited behaviours  
PeasantBehaviour, KingBehaviour, KnightBehaviour that all implement the 
RoleBehaviour interface (in American english, drop the 'u' in "behaviour".) You 
don't even need to change the current database. Just use the current 
inheritance 'type' field to map to a RoleBehaviour class. and now the 
RoleBehaviour becomes an attribute. The work involved is just EOModel 
simplification and breaking out the behaviours into classes

YMMV, Kieran


On Mar 31, 2010, at 10:48 PM, Ramsey Lee Gurley wrote:

> I can't see this being possible in Vertical or Horizontal, but with single 
> table... could the qualifying attribute be updated to 'promote' an entity to 
> a new class?  Let's say we have we have an abstract Person entity with three 
> subclasses, Peasant, Knight, King.  If I wanted to promote a knight to king, 
> is it possible to simply update my type attribute from knight to king and EOF 
> will start treating that record as a king instead of a knight?  I would 
> assume I would need to invalidate the existing knight object after saving 
> changes so it could be refetched as a king... and if I had multiple 
> instances, I'd need to invalidate it in those instances too... but is it 
> possible?  Or will EOF just flip out in the saveChanges() and refuse to do it?
> 
> Just an academic question, of course (^_^)
> 
> Ramsey ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com
> 
> This email sent to kieran_li...@mac.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an entity be promoted in single table inheritance?

2010-04-01 Thread Ken Anderson
Just say "NO".  Seriously, I've tried this before - went with the roles 
paradigm and never looked back.

Ken

On Mar 31, 2010, at 10:48 PM, Ramsey Lee Gurley wrote:

> I can't see this being possible in Vertical or Horizontal, but with single 
> table... could the qualifying attribute be updated to 'promote' an entity to 
> a new class?  Let's say we have we have an abstract Person entity with three 
> subclasses, Peasant, Knight, King.  If I wanted to promote a knight to king, 
> is it possible to simply update my type attribute from knight to king and EOF 
> will start treating that record as a king instead of a knight?  I would 
> assume I would need to invalidate the existing knight object after saving 
> changes so it could be refetched as a king... and if I had multiple 
> instances, I'd need to invalidate it in those instances too... but is it 
> possible?  Or will EOF just flip out in the saveChanges() and refuse to do it?
> 
> Just an academic question, of course (^_^)
> 
> Ramsey ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/kenlists%40anderhome.com
> 
> This email sent to kenli...@anderhome.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an entity be promoted in single table inheritance?

2010-03-31 Thread Mike Schrag
1) explosions
2) almost always indicative of a design flaw

Your example, for instance, is much better captured with Roles ... The peasant 
isn't himself changing, his role is changing. It may be TECHNICALLY possible to 
pull this off with a ton of craziness, but it would be horribly error prone. 
Imagine what would happen if you had a Peasant EO instantiated. What in the 
world would happen? (answer: explosion)

On Mar 31, 2010, at 10:48 PM, Ramsey Lee Gurley wrote:

> I can't see this being possible in Vertical or Horizontal, but with single 
> table... could the qualifying attribute be updated to 'promote' an entity to 
> a new class?  Let's say we have we have an abstract Person entity with three 
> subclasses, Peasant, Knight, King.  If I wanted to promote a knight to king, 
> is it possible to simply update my type attribute from knight to king and EOF 
> will start treating that record as a king instead of a knight?  I would 
> assume I would need to invalidate the existing knight object after saving 
> changes so it could be refetched as a king... and if I had multiple 
> instances, I'd need to invalidate it in those instances too... but is it 
> possible?  Or will EOF just flip out in the saveChanges() and refuse to do it?
> 
> Just an academic question, of course (^_^)
> 
> Ramsey ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com
> 
> This email sent to msch...@pobox.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an entity be promoted in single table inheritance?

2010-03-31 Thread Chuck Hill


On Mar 31, 2010, at 7:48 PM, Ramsey Lee Gurley wrote:

I can't see this being possible in Vertical or Horizontal, but with  
single table... could the qualifying attribute be updated to  
'promote' an entity to a new class?


F**k No!

Do NOT try this.  Use the Role pattern or something that won't make  
EOF insane.




Let's say we have we have an abstract Person entity with three  
subclasses, Peasant, Knight, King.  If I wanted to promote a knight  
to king, is it possible to simply update my type attribute from  
knight to king and EOF will start treating that record as a king  
instead of a knight?  I would assume I would need to invalidate the  
existing knight object after saving changes so it could be refetched  
as a king... and if I had multiple instances, I'd need to invalidate  
it in those instances too... but is it possible?  Or will EOF just  
flip out in the saveChanges() and refuse to do it?


Just an academic question, of course (^_^)



You could mybe get it to work if you invalidated enough things.   
But, really, do you want hair on your palms?



Chuck


--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects







___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Can an entity be promoted in single table inheritance?

2010-03-31 Thread Ramsey Lee Gurley
I can't see this being possible in Vertical or Horizontal, but with single 
table... could the qualifying attribute be updated to 'promote' an entity to a 
new class?  Let's say we have we have an abstract Person entity with three 
subclasses, Peasant, Knight, King.  If I wanted to promote a knight to king, is 
it possible to simply update my type attribute from knight to king and EOF will 
start treating that record as a king instead of a knight?  I would assume I 
would need to invalidate the existing knight object after saving changes so it 
could be refetched as a king... and if I had multiple instances, I'd need to 
invalidate it in those instances too... but is it possible?  Or will EOF just 
flip out in the saveChanges() and refuse to do it?

Just an academic question, of course (^_^)

Ramsey

smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Single-table inheritance error [SOLVED]

2009-09-30 Thread Jon Nolan



Also, in case it matters, resourceType is a javaEnum.
Bingo.  Changed it to a varchar50/String(RTRIM) and it works exactly 
as expected.


Not too sure if this qualifies as a bug or as a worst practice.  
Either way, thanks for the brain tweaks as they led me to solving in 
minutes something which has been driving me nuts all day.
maybe an entity modeler warning if your restricting qualifier 
attribute is a non-primitive type?

That would be monumentally helpful to the next guy.  ;-)

Thanks for the info about 
er.extensions.ERXEnterpriseObject.applyRestrictingQualifierOnInsert.

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single-table inheritance error [SOLVED]

2009-09-30 Thread Chuck Hill

On Sep 30, 2009, at 2:54 PM, Mike Schrag wrote:


Also, in case it matters, resourceType is a javaEnum.
Bingo.  Changed it to a varchar50/String(RTRIM) and it works  
exactly as expected.


Not too sure if this qualifies as a bug or as a worst practice.   
Either way, thanks for the brain tweaks as they led me to solving  
in minutes something which has been driving me nuts all day.
maybe an entity modeler warning if your restricting qualifier  
attribute is a non-primitive type?



That seems reasonable.

--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects







___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single-table inheritance error [SOLVED]

2009-09-30 Thread Mike Schrag

Also, in case it matters, resourceType is a javaEnum.
Bingo.  Changed it to a varchar50/String(RTRIM) and it works exactly  
as expected.


Not too sure if this qualifies as a bug or as a worst practice.   
Either way, thanks for the brain tweaks as they led me to solving in  
minutes something which has been driving me nuts all day.
maybe an entity modeler warning if your restricting qualifier  
attribute is a non-primitive type?


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single-table inheritance error

2009-09-30 Thread Mike Schrag

  public void awakeFromInsertion(EOEditingContext ec) {
  super.awakeFromInsertion(ec);
  setResourceType(ResourceType.Resource2);
  }

ew.
## Specifies that you want restricting qualifiers "applied" to your  
newly
## inserted objects.  For instance, if you have an entity that is part  
of

## single table inheritance and your restricting qualifier only uses
## EOAndQualifiers and EOKeyValueQualifiers, ERX can interpret the  
qualifier
## and make your EO's automatically match the restricting qualifier.   
This
## allows you to skip the awakeFromInsertion step where you have to  
remember
## to make your EO match the restricting qualifier you chose in your  
model.
#  
er.extensions.ERXEnterpriseObject.applyRestrictingQualifierOnInsert=true



Also, in case it matters, resourceType is a javaEnum.
no way this works, right? the restricting qualifier as defined in your  
model is not going to parse as an enum value, so I'm guessing this  
totally breaks ...


ms ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Single-table inheritance error [SOLVED]

2009-09-30 Thread Jon Nolan



   public void awakeFromInsertion(EOEditingContext ec) {
   super.awakeFromInsertion(ec);
   setResourceType(ResourceType.Resource2);
   }

Also, in case it matters, resourceType is a javaEnum.
Bingo.  Changed it to a varchar50/String(RTRIM) and it works exactly as 
expected.


Not too sure if this qualifies as a bug or as a worst practice.  Either 
way, thanks for the brain tweaks as they led me to solving in minutes 
something which has been driving me nuts all day.


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single-table inheritance error

2009-09-30 Thread Jon Nolan

Mike Schrag wrote:
  java.lang.IllegalStateException: Unable to determine subentity of 
'AbstractResource' for row: { ...bunch of attributes... }. Check that 
the attribute 'resourceType' is marked as a class property in the 
EOModel and that the value satisfies some subentity's restricting 
qualifier.


The attribute _is_ marked as a class property and the value _does_ 
satisfy some subentity's restricting qualifier.  This is beyond 
doubt.  I read somewhere once that there's a fluky thing wherein the 
order of the entities alphabetically within the model matters.  Hence 
my parent entity begins with "A" and is the very first entity in my 
model.  Doesn't help.

is it marked as a class property in every subclass, too?
It is.  Is it potentially a problem that it's marked as "allows null" 
across all entities?  I have it this way so as to get the template 
createResourceX() methods the way I want them with awakeFromInsertion() 
actually setting the resourceType.


public class Resource2 extends __Resource2 {
   private static Logger LOG = Logger.getLogger(Media.class);

   ...

   public void awakeFromInsertion(EOEditingContext ec) {
   super.awakeFromInsertion(ec);
   setResourceType(ResourceType.Resource2);
   }

}

Also, in case it matters, resourceType is a javaEnum.

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single-table inheritance error

2009-09-30 Thread Mike Schrag
This is beyond doubt.  I read somewhere once that there's a fluky  
thing wherein the order of the entities alphabetically within the  
model matters.  Hence my parent entity begins with "A" and is the  
very first entity in my model.  Doesn't help.

I don't recall that.
I can confirm this is not the case, actually. I have at least one  
model I know of where this isn't true.


I have had it working for weeks by making AbstractResource non- 
abstract and that gets me past the throw but it causes me problems  
in other areas (i.e.  a fetchRequiredXXX against Resource returns  
two copies.)  I'm coming back now to do this "the right way" and  
make single-table inheritance with an abstract parent work as I  
imagine it should.
Adding a unique restricting qualifier to the abstract entity should  
avoid the duplicates.  I don't recall running into this.

Yeah, I've never seen this either. +1 for "goofy model"

ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single-table inheritance error

2009-09-30 Thread Chuck Hill

Hi Jon,

On Sep 30, 2009, at 1:10 PM, Jon Nolan wrote:


I have something like this modeled in single-table inheritance:

AbstractResource
  Resource1
  Resource2
  ...
  ResourceN

AbstractResource is marked as abstract and a class attribute named  
"resourceType" handles the restricting qualifier.


If I execute this:

  NSArray resources =  
AbstractResource.fetchAllAbstractResources(ec());


I get this:

  java.lang.IllegalStateException: Unable to determine subentity of  
'AbstractResource' for row: { ...bunch of attributes... }. Check  
that the attribute 'resourceType' is marked as a class property in  
the EOModel and that the value satisfies some subentity's  
restricting qualifier.


The attribute _is_ marked as a class property and the value _does_  
satisfy some subentity's restricting qualifier.


Are you sure it is marked as a class property in every single entity?   
Is there one entity that has a subtle difference in the modeling of  
this?


 This is beyond doubt.  I read somewhere once that there's a fluky  
thing wherein the order of the entities alphabetically within the  
model matters.  Hence my parent entity begins with "A" and is the  
very first entity in my model.  Doesn't help.


I don't recall that.


I have had it working for weeks by making AbstractResource non- 
abstract and that gets me past the throw but it causes me problems  
in other areas (i.e.  a fetchRequiredXXX against Resource returns  
two copies.)  I'm coming back now to do this "the right way" and  
make single-table inheritance with an abstract parent work as I  
imagine it should.



Adding a unique restricting qualifier to the abstract entity should  
avoid the duplicates.  I don't recall running into this.


Chuck


--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects







___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single-table inheritance error

2009-09-30 Thread Mike Schrag
  java.lang.IllegalStateException: Unable to determine subentity of  
'AbstractResource' for row: { ...bunch of attributes... }. Check  
that the attribute 'resourceType' is marked as a class property in  
the EOModel and that the value satisfies some subentity's  
restricting qualifier.


The attribute _is_ marked as a class property and the value _does_  
satisfy some subentity's restricting qualifier.  This is beyond  
doubt.  I read somewhere once that there's a fluky thing wherein the  
order of the entities alphabetically within the model matters.   
Hence my parent entity begins with "A" and is the very first entity  
in my model.  Doesn't help.

is it marked as a class property in every subclass, too?

ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Single-table inheritance error

2009-09-30 Thread Jon Nolan

I have something like this modeled in single-table inheritance:

AbstractResource
   Resource1
   Resource2
   ...
   ResourceN

AbstractResource is marked as abstract and a class attribute named 
"resourceType" handles the restricting qualifier.


If I execute this:

   NSArray resources = 
AbstractResource.fetchAllAbstractResources(ec());


I get this:

   java.lang.IllegalStateException: Unable to determine subentity of 
'AbstractResource' for row: { ...bunch of attributes... }. Check that 
the attribute 'resourceType' is marked as a class property in the 
EOModel and that the value satisfies some subentity's restricting 
qualifier.


The attribute _is_ marked as a class property and the value _does_ 
satisfy some subentity's restricting qualifier.  This is beyond doubt.  
I read somewhere once that there's a fluky thing wherein the order of 
the entities alphabetically within the model matters.  Hence my parent 
entity begins with "A" and is the very first entity in my model.  
Doesn't help.


I have had it working for weeks by making AbstractResource non-abstract 
and that gets me past the throw but it causes me problems in other areas 
(i.e.  a fetchRequiredXXX against Resource returns two copies.)  I'm 
coming back now to do this "the right way" and make single-table 
inheritance with an abstract parent work as I imagine it should.


Any ideas?

Thanks,
Jon

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Single Table inheritance and EM question[SOLVED]

2008-08-20 Thread William Hatch
Damn. So, I was using the static fetch methods inherited from the  
abstract parent fetchSummaries within my own static fetches. I  
switched to using the ones from the _Parent... where it explicitly  
says fetchDay/Hour/Month summaries... Maybe I should switch brands of  
coffee?  Or go directly to beer. Thanks and sorry for any time wasting.

On Aug 20, 2008, at 4:06 PM, William Hatch wrote:



On Aug 20, 2008, at 2:08 PM, Chuck Hill wrote:



On Aug 20, 2008, at 10:06 AM, William Hatch wrote:



On Aug 20, 2008, at 12:15 PM, Mike Schrag wrote:

Fetches to one are resulting in generated sql to all three  
types, as if I'm fetching on the abstract parent, which I'm not.
Is this fetching to one of these from a completely separate  
entity, or fetching to-one from its reflexive relationship?  Is  
this the same problem that someone else ran into a couple days  
ago with relationships from subtypes to the base class of another  
entity (guido mentioned something about ERAttachment here that I  
never saw?).


I have an abstract parent Summary, with three concrete sub types;  
HourSummary, DaySummary, MonthSummary. Month has (optional) a to- 
many to Day, which in turn has (optional) a to-many to Hour. None  
of these should be getting tripped right now and are not  
prefetched. So, if I fetch say HourSummary's, I see three sql  
selects for Hour, Day and Month. It's almost as if the qualifying  
attribute is being ignored, although each sql statement has it in  
the where clause matching what I defined in the model in the Basic  
tab, Qualifier field (see original post) So one fetch to a  
specific Entity results in sql selects for all three, with result  
sets coming back from all three. Ouch;-) At least it's fast.  
Thanks Mike



Something is messed up in the model.  Is the parent of each sub- 
entity set correctly?  Like Mike said, this sounds like the SQL  
from Horizontal Inheritance.  My best guess is that something in  
the model (table names not _exact_ -- case counts?) is making EOF  
think this is not single table inheritance.


The sub entities all have the Parent defined as Summary (using the  
pop up) The Summary entity is abstract, and does not have a  
corresponding table set; I thought this was correct; is it? Each of  
the sub types use this as the distinguishing qualifier  
(summaryRangeType="month") where summaryRangeType is a class  
property and is set in the class over ride of awakeFromInsertion,  
although we're not using EOF to populate it anyway, but again  
thought this was the standard way to go about implementing single  
table inheritance. Thanks Chuck.


Bill



Chuck

--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects








___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/wkhatch%40me.com

This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread Guido Neitzer
On 20.08.08 14:26, "William Hatch" <[EMAIL PROTECTED]> wrote:

> I just tried setting the table for the abstract entity, and that
> results in a single sql statement, but unfortunately all the possible
> values for the differentiating key are all nicely OR'd together in the
> resulting where clause. At least we're improving on efficiency maybe;-)

Hmmm. So something else seems to be screwed up. How do you do the fetch?

cug


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread William Hatch



On Aug 20, 2008, at 4:06 PM, William Hatch wrote:



On Aug 20, 2008, at 2:08 PM, Chuck Hill wrote:



On Aug 20, 2008, at 10:06 AM, William Hatch wrote:



On Aug 20, 2008, at 12:15 PM, Mike Schrag wrote:

Fetches to one are resulting in generated sql to all three  
types, as if I'm fetching on the abstract parent, which I'm not.
Is this fetching to one of these from a completely separate  
entity, or fetching to-one from its reflexive relationship?  Is  
this the same problem that someone else ran into a couple days  
ago with relationships from subtypes to the base class of another  
entity (guido mentioned something about ERAttachment here that I  
never saw?).


I have an abstract parent Summary, with three concrete sub types;  
HourSummary, DaySummary, MonthSummary. Month has (optional) a to- 
many to Day, which in turn has (optional) a to-many to Hour. None  
of these should be getting tripped right now and are not  
prefetched. So, if I fetch say HourSummary's, I see three sql  
selects for Hour, Day and Month. It's almost as if the qualifying  
attribute is being ignored, although each sql statement has it in  
the where clause matching what I defined in the model in the Basic  
tab, Qualifier field (see original post) So one fetch to a  
specific Entity results in sql selects for all three, with result  
sets coming back from all three. Ouch;-) At least it's fast.  
Thanks Mike



Something is messed up in the model.  Is the parent of each sub- 
entity set correctly?  Like Mike said, this sounds like the SQL  
from Horizontal Inheritance.  My best guess is that something in  
the model (table names not _exact_ -- case counts?) is making EOF  
think this is not single table inheritance.


The sub entities all have the Parent defined as Summary (using the  
pop up) The Summary entity is abstract, and does not have a  
corresponding table set; I thought this was correct; is it? Each of  
the sub types use this as the distinguishing qualifier  
(summaryRangeType="month") where summaryRangeType is a class  
property and is set in the class over ride of awakeFromInsertion,  
although we're not using EOF to populate it anyway, but again  
thought this was the standard way to go about implementing single  
table inheritance. Thanks Chuck.


I just tried setting the table for the abstract entity, and that  
results in a single sql statement, but unfortunately all the possible  
values for the differentiating key are all nicely OR'd together in the  
resulting where clause. At least we're improving on efficiency maybe;-)



Bill



Chuck

--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects








___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/wkhatch%40me.com

This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread Chuck Hill


On Aug 20, 2008, at 1:06 PM, William Hatch wrote:



On Aug 20, 2008, at 2:08 PM, Chuck Hill wrote:



On Aug 20, 2008, at 10:06 AM, William Hatch wrote:



On Aug 20, 2008, at 12:15 PM, Mike Schrag wrote:

Fetches to one are resulting in generated sql to all three  
types, as if I'm fetching on the abstract parent, which I'm not.
Is this fetching to one of these from a completely separate  
entity, or fetching to-one from its reflexive relationship?  Is  
this the same problem that someone else ran into a couple days  
ago with relationships from subtypes to the base class of another  
entity (guido mentioned something about ERAttachment here that I  
never saw?).


I have an abstract parent Summary, with three concrete sub types;  
HourSummary, DaySummary, MonthSummary. Month has (optional) a to- 
many to Day, which in turn has (optional) a to-many to Hour. None  
of these should be getting tripped right now and are not  
prefetched. So, if I fetch say HourSummary's, I see three sql  
selects for Hour, Day and Month. It's almost as if the qualifying  
attribute is being ignored, although each sql statement has it in  
the where clause matching what I defined in the model in the Basic  
tab, Qualifier field (see original post) So one fetch to a  
specific Entity results in sql selects for all three, with result  
sets coming back from all three. Ouch;-) At least it's fast.  
Thanks Mike



Something is messed up in the model.  Is the parent of each sub- 
entity set correctly?  Like Mike said, this sounds like the SQL  
from Horizontal Inheritance.  My best guess is that something in  
the model (table names not _exact_ -- case counts?) is making EOF  
think this is not single table inheritance.


The sub entities all have the Parent defined as Summary (using the  
pop up) The Summary entity is abstract, and does not have a  
corresponding table set; I thought this was correct; is it?


No, I think the table needs to be set.  That is what EOF uses to  
generate PKs for the inheritance hierarchy.



Each of the sub types use this as the distinguishing qualifier  
(summaryRangeType="month") where summaryRangeType is a class  
property and is set in the class over ride of awakeFromInsertion,  
although we're not using EOF to populate it anyway,


What does "we're not using EOF to populate it anyway" mean?


but again thought this was the standard way to go about implementing  
single table inheritance. Thanks Chuck.



It is (for me), other than the table on the base class.


Chuck

--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects






___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread Guido Neitzer
On 20.08.08 14:06, "William Hatch" <[EMAIL PROTECTED]> wrote:

> The sub entities all have the Parent defined as Summary (using the pop
> up) The Summary entity is abstract, and does not have a corresponding
> table set; I thought this was correct; is it? Each of the sub types
> use this as the distinguishing qualifier (summaryRangeType="month")
> where summaryRangeType is a class property and is set in the class
> over ride of awakeFromInsertion, although we're not using EOF to
> populate it anyway, but again thought this was the standard way to go
> about implementing single table inheritance. Thanks Chuck.

I don't know whether it makes a difference, but I also always set the table
on the abstract base entity.

Side note: if you are using ProjectWonder you should do initialization in
init, not in awakeFromInsertion. Or check whether the object is a new object
and only do the initialization there.

cug


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread William Hatch


On Aug 20, 2008, at 2:08 PM, Chuck Hill wrote:



On Aug 20, 2008, at 10:06 AM, William Hatch wrote:



On Aug 20, 2008, at 12:15 PM, Mike Schrag wrote:

Fetches to one are resulting in generated sql to all three types,  
as if I'm fetching on the abstract parent, which I'm not.
Is this fetching to one of these from a completely separate  
entity, or fetching to-one from its reflexive relationship?  Is  
this the same problem that someone else ran into a couple days ago  
with relationships from subtypes to the base class of another  
entity (guido mentioned something about ERAttachment here that I  
never saw?).


I have an abstract parent Summary, with three concrete sub types;  
HourSummary, DaySummary, MonthSummary. Month has (optional) a to- 
many to Day, which in turn has (optional) a to-many to Hour. None  
of these should be getting tripped right now and are not  
prefetched. So, if I fetch say HourSummary's, I see three sql  
selects for Hour, Day and Month. It's almost as if the qualifying  
attribute is being ignored, although each sql statement has it in  
the where clause matching what I defined in the model in the Basic  
tab, Qualifier field (see original post) So one fetch to a specific  
Entity results in sql selects for all three, with result sets  
coming back from all three. Ouch;-) At least it's fast. Thanks Mike



Something is messed up in the model.  Is the parent of each sub- 
entity set correctly?  Like Mike said, this sounds like the SQL from  
Horizontal Inheritance.  My best guess is that something in the  
model (table names not _exact_ -- case counts?) is making EOF think  
this is not single table inheritance.


The sub entities all have the Parent defined as Summary (using the pop  
up) The Summary entity is abstract, and does not have a corresponding  
table set; I thought this was correct; is it? Each of the sub types  
use this as the distinguishing qualifier (summaryRangeType="month")  
where summaryRangeType is a class property and is set in the class  
over ride of awakeFromInsertion, although we're not using EOF to  
populate it anyway, but again thought this was the standard way to go  
about implementing single table inheritance. Thanks Chuck.


Bill



Chuck

--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects








___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread Chuck Hill


On Aug 20, 2008, at 10:06 AM, William Hatch wrote:



On Aug 20, 2008, at 12:15 PM, Mike Schrag wrote:

Fetches to one are resulting in generated sql to all three types,  
as if I'm fetching on the abstract parent, which I'm not.
Is this fetching to one of these from a completely separate entity,  
or fetching to-one from its reflexive relationship?  Is this the  
same problem that someone else ran into a couple days ago with  
relationships from subtypes to the base class of another entity  
(guido mentioned something about ERAttachment here that I never  
saw?).


I have an abstract parent Summary, with three concrete sub types;  
HourSummary, DaySummary, MonthSummary. Month has (optional) a to- 
many to Day, which in turn has (optional) a to-many to Hour. None of  
these should be getting tripped right now and are not prefetched.  
So, if I fetch say HourSummary's, I see three sql selects for Hour,  
Day and Month. It's almost as if the qualifying attribute is being  
ignored, although each sql statement has it in the where clause  
matching what I defined in the model in the Basic tab, Qualifier  
field (see original post) So one fetch to a specific Entity results  
in sql selects for all three, with result sets coming back from all  
three. Ouch;-) At least it's fast. Thanks Mike



Something is messed up in the model.  Is the parent of each sub-entity  
set correctly?  Like Mike said, this sounds like the SQL from  
Horizontal Inheritance.  My best guess is that something in the model  
(table names not _exact_ -- case counts?) is making EOF think this is  
not single table inheritance.


Chuck

--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects






___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread William Hatch


On Aug 20, 2008, at 12:40 PM, Guido Neitzer wrote:


On 20.08.08 09:56, "William Hatch" <[EMAIL PROTECTED]> wrote:


 Hi Mike, it's the same on all entities. And, in response to Guido's
thought. there's nothing hitting the relationships within this  
context

and they're not prefetched either.


Are the entities all in the same model? I ask only because I saw  
some weird
behaviour last week with inheritance and connection dictionaries not  
exactly

matching.


Yes, all in the same model, and all relationship are also in the same  
model.



cug




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread William Hatch


On Aug 20, 2008, at 12:15 PM, Mike Schrag wrote:

Fetches to one are resulting in generated sql to all three types,  
as if I'm fetching on the abstract parent, which I'm not.
Is this fetching to one of these from a completely separate entity,  
or fetching to-one from its reflexive relationship?  Is this the  
same problem that someone else ran into a couple days ago with  
relationships from subtypes to the base class of another entity  
(guido mentioned something about ERAttachment here that I never saw?).


I have an abstract parent Summary, with three concrete sub types;  
HourSummary, DaySummary, MonthSummary. Month has (optional) a to-many  
to Day, which in turn has (optional) a to-many to Hour. None of these  
should be getting tripped right now and are not prefetched. So, if I  
fetch say HourSummary's, I see three sql selects for Hour, Day and  
Month. It's almost as if the qualifying attribute is being ignored,  
although each sql statement has it in the where clause matching what I  
defined in the model in the Basic tab, Qualifier field (see original  
post) So one fetch to a specific Entity results in sql selects for all  
three, with result sets coming back from all three. Ouch;-) At least  
it's fast. Thanks Mike


Bill



ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/wkhatch%40me.com

This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread Guido Neitzer
On 20.08.08 09:56, "William Hatch" <[EMAIL PROTECTED]> wrote:

>   Hi Mike, it's the same on all entities. And, in response to Guido's
> thought. there's nothing hitting the relationships within this context
> and they're not prefetched either.

Are the entities all in the same model? I ask only because I saw some weird
behaviour last week with inheritance and connection dictionaries not exactly
matching.

cug


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread Mike Schrag
Fetches to one are resulting in generated sql to all three types, as  
if I'm fetching on the abstract parent, which I'm not.
Is this fetching to one of these from a completely separate entity, or  
fetching to-one from its reflexive relationship?  Is this the same  
problem that someone else ran into a couple days ago with  
relationships from subtypes to the base class of another entity (guido  
mentioned something about ERAttachment here that I never saw?).


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread William Hatch
 Hi Mike, it's the same on all entities. And, in response to Guido's  
thought. there's nothing hitting the relationships within this context  
and they're not prefetched either.


Bill




On Aug 20, 2008, at 10:56 AM, Mike Schrag wrote:

I should also note that there are three separate select statements  
being generated; one for each of the concrete types; it's not one  
select with some OR's in the where. Not sure if that helps shed  
light on this. Thanks again.
I would verify that the table name is the same for all your  
entities.  This sounds like what I would expect from horizontal  
inheritance.


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/wkhatch%40me.com

This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread Mike Schrag
I should also note that there are three separate select statements  
being generated; one for each of the concrete types; it's not one  
select with some OR's in the where. Not sure if that helps shed  
light on this. Thanks again.
I would verify that the table name is the same for all your entities.   
This sounds like what I would expect from horizontal inheritance.


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread Guido Neitzer
Wild guess: are you maybe just seeing the relationships being resolved? Or
is it really getting all objects, when you ask for one without prefetching
any relationships?

cug


On 20.08.08 08:38, "William Hatch" <[EMAIL PROTECTED]> wrote:

> I should also note that there are three separate select statements
> being generated; one for each of the concrete types; it's not one
> select with some OR's in the where. Not sure if that helps shed light
> on this. Thanks again.
> 
> On Aug 20, 2008, at 3:31 AM, William Hatch wrote:
> 
>> First project using EM and single table inheritance, I've got an
>> abstract base entity, with three concrete sub types, I'm putting a
>> qualifier in the Basic Tab's Qualifier field in the form of
>> (summaryRangeType="hour"), etc for each of the three types,
>> obviously with different values for each. The column used for
>> differentiating the types, "summaryRangeType" is a class property.
>> There are some reflexive relationships between the the three sub
>> types, which are always used, but not constrained as mandatory.
>> Fetches to one are resulting in generated sql to all three types, as
>> if I'm fetching on the abstract parent, which I'm not.  What am I
>> forgetting or not doing correctly in EM? Thanks.
>> 
>> 
>> Bill
>> 
>> 
>> 
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/wkhatch%40me.com
>> 
>> This email sent to [EMAIL PROTECTED]
> 
>  ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/lists%40event-s.net
> 
> This email sent to [EMAIL PROTECTED]


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Single Table inheritance and EM question

2008-08-20 Thread William Hatch
I should also note that there are three separate select statements  
being generated; one for each of the concrete types; it's not one  
select with some OR's in the where. Not sure if that helps shed light  
on this. Thanks again.


On Aug 20, 2008, at 3:31 AM, William Hatch wrote:

First project using EM and single table inheritance, I've got an  
abstract base entity, with three concrete sub types, I'm putting a  
qualifier in the Basic Tab's Qualifier field in the form of  
(summaryRangeType="hour"), etc for each of the three types,  
obviously with different values for each. The column used for  
differentiating the types, "summaryRangeType" is a class property.  
There are some reflexive relationships between the the three sub  
types, which are always used, but not constrained as mandatory.  
Fetches to one are resulting in generated sql to all three types, as  
if I'm fetching on the abstract parent, which I'm not.  What am I  
forgetting or not doing correctly in EM? Thanks.



Bill




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/wkhatch%40me.com

This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Single Table inheritance and EM question

2008-08-20 Thread William Hatch
First project using EM and single table inheritance, I've got an  
abstract base entity, with three concrete sub types, I'm putting a  
qualifier in the Basic Tab's Qualifier field in the form of  
(summaryRangeType="hour"), etc for each of the three types, obviously  
with different values for each. The column used for differentiating  
the types, "summaryRangeType" is a class property. There are some  
reflexive relationships between the the three sub types, which are  
always used, but not constrained as mandatory. Fetches to one are  
resulting in generated sql to all three types, as if I'm fetching on  
the abstract parent, which I'm not.  What am I forgetting or not doing  
correctly in EM? Thanks.


Bill




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Redundant Results from Fetch to Single Table Inheritance Entity

2007-11-10 Thread Jerry W. Walker

Hi, Chuck,

Thanks for taking a look. I did some Googling before either fixing  
the problem or posting the issue on the list.


I'll try to put a simple example together this weekend and get it to  
fail in the same way. Then I'll ship it off to Apple's Radar.


Regards,
Jerry

On Nov 9, 2007, at 12:56 PM, Chuck Hill wrote:

Thought about this for a while.  The only explanation that I can  
come up with is "a bug in EOF".  I don't recall anyone having run  
into this, but that does not mean much.


Chuck

On Nov 8, 2007, at 5:28 AM, Jerry W. Walker wrote:


Greetings,

I don't seem to be getting the correct SQL generated for a query  
and I'm ending up with redundant results. I've fixed the problem  
by adding an additional explicit EOQualifier to do the job that I  
think that EOF should be doing, so this is no longer an immediate  
problem. However, I'd like to throw the question out to the list  
to determine if: 1) I'm doing anything wrong to cause the SQL to  
be generated the way it is, or 2) whether there's a bug in EOF  
that I should report (or have known about if already reported).


Environment:
WO 5.3
OpenBase 10.0

We have an EOModel with several entities, say, Student, School,  
Teacher, etc. that have locations. The Location entity contains  
address, city, state, postalCode, phone, and so forth. Using  
single-table inheritance, We have several subentities for location  
to match the entities being located, such as StudentLocation,  
SchoolLocation, TeacherLocation, etc.


Each of the entities with locations has a one-to-many relationship  
with the appropriate subentity for its locations, such as:


Student <->> StudentLocation

School <->> SchoolLocation

Teacher <->> TeacherLocation

The parent Location entity has a partyID attribute to hold the  
foreign key for the to-one relationship back to the located entity  
and, of course, a locationType attribute to distinguish among the  
Location subentities.


We also use a State reference table/entity to hold the state's  
full name (e.g. "New York") and the state's abbreviation (e.g. "NY").



To search for all male students in New York, NY with an  
"Underwater Basketweaving" major, I use the following code to  
build and execute the fetch:


static final NSArray preFetchKeyPaths = new NSArray(new Object[] {
"locations",
"locations.state",
"locations.zipCodeLocation"
});

...

EOQualifier qual;
NSMutableArray theQualifiers = new NSMutableArray();

	qual = EOQualifier.qualifierWithQualifierFormat 
("locations.state.abbreviation caseInsensitiveLike %s", new NSArray 
(selectedStateAbbreviation));

theQualifiers.addObject(qual);

	qual = EOQualifier.qualifierWithQualifierFormat("locations.city  
caseInsensitiveLike %s", new NSArray(selectedCityName));

theQualifiers.addObject(qual);

	qual = EOQualifier.qualifierWithQualifierFormat("major  
caseInsensitiveLike %s", new NSArray(selectedMajor.name()));

theQualifiers.addObject(qual);

	EOFetchSpecification fs = new EOFetchSpecification 
("StudentRecord", new EOAndQualifier(theQualifiers), null);
	LOGGER.debug("Get the DoctorRecords with qualifiers = " + new  
EOAndQualifier(theQualifiers).toString());

fs.setPrefetchingRelationshipKeyPaths(preFetchKeyPaths);
filteredDoctors = ec.objectsWithFetchSpecification(fs);


The problem occurs if a Student happens to have the same address  
as a Teacher or School. The SQL that's generated for the above  
fetch is as follows:



[2007-11-06 09:33:14 EST]   evaluateExpression:  
"SELECT t0.MAJOR, t0.EMAIL_ADDRESS, t0.FIRST_NAME,  
t0.LAST_NAME, ..., FROM STUDENT_RECORD t0, STATE T2, LOCATION T1  
WHERE (UPPER(T2.ABBREVIATION) LIKE UPPER(?) AND UPPER(T1.CITY)  
LIKE UPPER(?) AND UPPER(t0.MAJOR) LIKE UPPER(?)) AND T1.STATE_ID =  
T2.OID AND t0.OID = T1.PARTY_ID" withBindings:  
1:"NY"(abbreviation), 2:"New York"(city), 3:"Underwater  
Basketweaving"(major)>



I don't understand why EOF doesn't automatically add the WHERE  
clause: "t0.LOCATION_TYPE = ? AND ".


Notice the setPrefetchingRelationshipKeyPaths statement. That  
causes the generation of the following SQL statements as well,  
which EACH INCLUDE THE LOCATION_TYPE CLAUSE appropriately:



[2007-11-08 07:33:14 EST]   evaluateExpression:  
"SELECT t0.ADDRESS_1, t0.ADDRESS_2, t0.CITY, t0.PARTY_ID,  
t0.LOCATION_TYPE, t0.OID, t0.PHONE_NUMBER, t0.POSTAL_CODE,  
t0.STATE_ID, t0.ZIP_CODE_ID FROM LOCATION t0, STUDENT T1, STATE T2  
WHERE (t0

Re: Redundant Results from Fetch to Single Table Inheritance Entity

2007-11-09 Thread Chuck Hill
Thought about this for a while.  The only explanation that I can come  
up with is "a bug in EOF".  I don't recall anyone having run into  
this, but that does not mean much.


Chuck

On Nov 8, 2007, at 5:28 AM, Jerry W. Walker wrote:


Greetings,

I don't seem to be getting the correct SQL generated for a query  
and I'm ending up with redundant results. I've fixed the problem by  
adding an additional explicit EOQualifier to do the job that I  
think that EOF should be doing, so this is no longer an immediate  
problem. However, I'd like to throw the question out to the list to  
determine if: 1) I'm doing anything wrong to cause the SQL to be  
generated the way it is, or 2) whether there's a bug in EOF that I  
should report (or have known about if already reported).


Environment:
WO 5.3
OpenBase 10.0

We have an EOModel with several entities, say, Student, School,  
Teacher, etc. that have locations. The Location entity contains  
address, city, state, postalCode, phone, and so forth. Using single- 
table inheritance, We have several subentities for location to  
match the entities being located, such as StudentLocation,  
SchoolLocation, TeacherLocation, etc.


Each of the entities with locations has a one-to-many relationship  
with the appropriate subentity for its locations, such as:


Student <->> StudentLocation

School <->> SchoolLocation

Teacher <->> TeacherLocation

The parent Location entity has a partyID attribute to hold the  
foreign key for the to-one relationship back to the located entity  
and, of course, a locationType attribute to distinguish among the  
Location subentities.


We also use a State reference table/entity to hold the state's full  
name (e.g. "New York") and the state's abbreviation (e.g. "NY").



To search for all male students in New York, NY with an "Underwater  
Basketweaving" major, I use the following code to build and execute  
the fetch:


static final NSArray preFetchKeyPaths = new NSArray(new Object[] {
"locations",
"locations.state",
"locations.zipCodeLocation"
});

...

EOQualifier qual;
NSMutableArray theQualifiers = new NSMutableArray();

	qual = EOQualifier.qualifierWithQualifierFormat 
("locations.state.abbreviation caseInsensitiveLike %s", new NSArray 
(selectedStateAbbreviation));

theQualifiers.addObject(qual);

	qual = EOQualifier.qualifierWithQualifierFormat("locations.city  
caseInsensitiveLike %s", new NSArray(selectedCityName));

theQualifiers.addObject(qual);

	qual = EOQualifier.qualifierWithQualifierFormat("major  
caseInsensitiveLike %s", new NSArray(selectedMajor.name()));

theQualifiers.addObject(qual);

	EOFetchSpecification fs = new EOFetchSpecification 
("StudentRecord", new EOAndQualifier(theQualifiers), null);
	LOGGER.debug("Get the DoctorRecords with qualifiers = " + new  
EOAndQualifier(theQualifiers).toString());

fs.setPrefetchingRelationshipKeyPaths(preFetchKeyPaths);
filteredDoctors = ec.objectsWithFetchSpecification(fs);


The problem occurs if a Student happens to have the same address as  
a Teacher or School. The SQL that's generated for the above fetch  
is as follows:



[2007-11-06 09:33:14 EST]   evaluateExpression:  
"SELECT t0.MAJOR, t0.EMAIL_ADDRESS, t0.FIRST_NAME,  
t0.LAST_NAME, ..., FROM STUDENT_RECORD t0, STATE T2, LOCATION T1  
WHERE (UPPER(T2.ABBREVIATION) LIKE UPPER(?) AND UPPER(T1.CITY) LIKE  
UPPER(?) AND UPPER(t0.MAJOR) LIKE UPPER(?)) AND T1.STATE_ID =  
T2.OID AND t0.OID = T1.PARTY_ID" withBindings:  
1:"NY"(abbreviation), 2:"New York"(city), 3:"Underwater  
Basketweaving"(major)>



I don't understand why EOF doesn't automatically add the WHERE  
clause: "t0.LOCATION_TYPE = ? AND ".


Notice the setPrefetchingRelationshipKeyPaths statement. That  
causes the generation of the following SQL statements as well,  
which EACH INCLUDE THE LOCATION_TYPE CLAUSE appropriately:



[2007-11-08 07:33:14 EST]   evaluateExpression:  
"SELECT t0.ADDRESS_1, t0.ADDRESS_2, t0.CITY, t0.PARTY_ID,  
t0.LOCATION_TYPE, t0.OID, t0.PHONE_NUMBER, t0.POSTAL_CODE,  
t0.STATE_ID, t0.ZIP_CODE_ID FROM LOCATION t0, STUDENT T1, STATE T2  
WHERE (t0.LOCATION_TYPE = ? AND (UPPER(T1.MAJOR) LIKE UPPER(?) AND  
UPPER(t0.CITY) LIKE UPPER(?) AND UPPER(T2.ABBREVIATION) LIKE UPPER 
(?))) AND t0.PARTY_ID = T1.OID AND t0.STATE_ID = T2.OID"  
withBindings: 1:6(locationType), 2:"Underwater  
Basketweaving"(major), 3:"New York"(city), 4:"NY"(abbreviation)>

=

Redundant Results from Fetch to Single Table Inheritance Entity

2007-11-08 Thread Jerry W. Walker

Greetings,

I don't seem to be getting the correct SQL generated for a query and  
I'm ending up with redundant results. I've fixed the problem by  
adding an additional explicit EOQualifier to do the job that I think  
that EOF should be doing, so this is no longer an immediate problem.  
However, I'd like to throw the question out to the list to determine  
if: 1) I'm doing anything wrong to cause the SQL to be generated the  
way it is, or 2) whether there's a bug in EOF that I should report  
(or have known about if already reported).


Environment:
WO 5.3
OpenBase 10.0

We have an EOModel with several entities, say, Student, School,  
Teacher, etc. that have locations. The Location entity contains  
address, city, state, postalCode, phone, and so forth. Using single- 
table inheritance, We have several subentities for location to match  
the entities being located, such as StudentLocation, SchoolLocation,  
TeacherLocation, etc.


Each of the entities with locations has a one-to-many relationship  
with the appropriate subentity for its locations, such as:


Student <->> StudentLocation

School <->> SchoolLocation

Teacher <->> TeacherLocation

The parent Location entity has a partyID attribute to hold the  
foreign key for the to-one relationship back to the located entity  
and, of course, a locationType attribute to distinguish among the  
Location subentities.


We also use a State reference table/entity to hold the state's full  
name (e.g. "New York") and the state's abbreviation (e.g. "NY").



To search for all male students in New York, NY with an "Underwater  
Basketweaving" major, I use the following code to build and execute  
the fetch:


static final NSArray preFetchKeyPaths = new NSArray(new Object[] {
"locations",
"locations.state",
"locations.zipCodeLocation"
});

...

EOQualifier qual;
NSMutableArray theQualifiers = new NSMutableArray();

	qual = EOQualifier.qualifierWithQualifierFormat 
("locations.state.abbreviation caseInsensitiveLike %s", new NSArray 
(selectedStateAbbreviation));

theQualifiers.addObject(qual);

	qual = EOQualifier.qualifierWithQualifierFormat("locations.city  
caseInsensitiveLike %s", new NSArray(selectedCityName));

theQualifiers.addObject(qual);

	qual = EOQualifier.qualifierWithQualifierFormat("major  
caseInsensitiveLike %s", new NSArray(selectedMajor.name()));

theQualifiers.addObject(qual);

	EOFetchSpecification fs = new EOFetchSpecification("StudentRecord",  
new EOAndQualifier(theQualifiers), null);
	LOGGER.debug("Get the DoctorRecords with qualifiers = " + new  
EOAndQualifier(theQualifiers).toString());

fs.setPrefetchingRelationshipKeyPaths(preFetchKeyPaths);
filteredDoctors = ec.objectsWithFetchSpecification(fs);


The problem occurs if a Student happens to have the same address as a  
Teacher or School. The SQL that's generated for the above fetch is as  
follows:



[2007-11-06 09:33:14 EST]   evaluateExpression:  
"SELECT t0.MAJOR, t0.EMAIL_ADDRESS, t0.FIRST_NAME, t0.LAST_NAME, ...,  
FROM STUDENT_RECORD t0, STATE T2, LOCATION T1 WHERE (UPPER 
(T2.ABBREVIATION) LIKE UPPER(?) AND UPPER(T1.CITY) LIKE UPPER(?) AND  
UPPER(t0.MAJOR) LIKE UPPER(?)) AND T1.STATE_ID = T2.OID AND t0.OID =  
T1.PARTY_ID" withBindings: 1:"NY"(abbreviation), 2:"New York"(city),  
3:"Underwater Basketweaving"(major)>



I don't understand why EOF doesn't automatically add the WHERE  
clause: "t0.LOCATION_TYPE = ? AND ".


Notice the setPrefetchingRelationshipKeyPaths statement. That causes  
the generation of the following SQL statements as well, which EACH  
INCLUDE THE LOCATION_TYPE CLAUSE appropriately:



[2007-11-08 07:33:14 EST]   evaluateExpression:  
"SELECT t0.ADDRESS_1, t0.ADDRESS_2, t0.CITY, t0.PARTY_ID,  
t0.LOCATION_TYPE, t0.OID, t0.PHONE_NUMBER, t0.POSTAL_CODE,  
t0.STATE_ID, t0.ZIP_CODE_ID FROM LOCATION t0, STUDENT T1, STATE T2  
WHERE (t0.LOCATION_TYPE = ? AND (UPPER(T1.MAJOR) LIKE UPPER(?) AND  
UPPER(t0.CITY) LIKE UPPER(?) AND UPPER(T2.ABBREVIATION) LIKE UPPER 
(?))) AND t0.PARTY_ID = T1.OID AND t0.STATE_ID = T2.OID"  
withBindings: 1:6(locationType), 2:"Underwater Basketweaving"(major),  
3:"New York"(city), 4:"NY"(abbreviation)>




[2007-11-08 07:33:14 EST]   evaluateExpression:  
"SELECT DISTINCT t0.ABBREVIATION, t0.NAME, t0.OID FROM STATE t0,  
LOCATION T1, STUDENT T2 WHERE ((UPPER(

Re: Single table inheritance and non-null attributes

2006-12-04 Thread Robert Walker

yes, please do that.
and if you find something else that is actually better than WO (i  
couldn’t), come back and tell us!


For most of my personal needs this mission has already been  
accomplished.  I won't specify my alternative (to prevent further  
flaming), but I do need to keep up with WO as long as I have legacy  
code developed in WO.


On Dec 4, 2006, at 3:52 AM, Alexander Spohr wrote:



Am 03.12.2006 um 03:19 schrieb Robert Walker:

If your point here is, "Use our stuff or go find something else."   
We'll I guess it's time to go find something else.


yes, please do that.
and if you find something else that is actually better than WO (i  
couldn’t), come back and tell us!


meanwhile i'll stick to WO.

atze



Freeport & Soliversum
Alexander Spohr
[EMAIL PROTECTED]
www.freeport.de




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Single table inheritance and non-null attributes

2006-12-04 Thread Alexander Spohr


Am 03.12.2006 um 03:19 schrieb Robert Walker:

If your point here is, "Use our stuff or go find something else."   
We'll I guess it's time to go find something else.


yes, please do that.
and if you find something else that is actually better than WO (i  
couldn’t), come back and tell us!


meanwhile i'll stick to WO.

atze



Freeport & Soliversum
Alexander Spohr
[EMAIL PROTECTED]
www.freeport.de


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Single table inheritance and non-null attributes

2006-12-02 Thread Robert Walker

Anjo,

That's great that you went in and fixed EOF, but my point is that EOF  
should do all this "out-of-the-box."  And apparently you agree with  
me, since you fixed these issues in Project Wonder.  I don't get why  
you guys don't just go off and build you own web framework and be  
done with it.


I guess I'll just keep my big mouth shut and let you guys have  
WebObjects and Project Wonder.  I'm about done with it anyway.  I'm  
starting to see the light that Apple has no interest in supporting  
developers with their own solutions, so now we're stuck with trying  
to get support from an open source community that has more interest  
in criticizing people than trying to help.


In any case, why would I want to continue to use a development  
framework that requires major portions of the core classes to be  
patched in order to work in a way that makes sense.  I suppose that's  
the only way to get things done, since you don't have access to the  
actual core classes from Apple, and Apple obviously has no interest  
in fixing the system themselves.  The less Apple is interested in  
this framework, the less I'm becoming interested in it.


If your point here is, "Use our stuff or go find something else."   
We'll I guess it's time to go find something else.



On Dec 2, 2006, at 2:43 PM, Anjo Krank wrote:



Am 01.12.2006 um 21:27 schrieb Robert Walker:

I actually made change a while back that is, indirectly, related  
to this issue.  A simply stopped using any of the validations in  
the EOModel, and I now do all my validation in the custom classes.


This may sound strange, but there is a method to my madness.  I  
want to have control over the validation messages that will be  
displayed  to the user.  Especially when it comes to failures on  
relationship constraints.  Instead of the technobabble that  
EOModel products, I want something more human readable like  
"Please assign the user to a department before saving."  Or  
changing the default string for "not null" to something like "Date  
cannot be left empty.  [Example: 12/01/2006]"


Yaddayadda. Project Wonder. Yadda.

Yawn.

To elaborate some more: we have custom validation parsers since  
basically Day One (cudos to Max for that). We even allow for multi- 
property failures like "you need a Foo if you have a Bar but no  
Baz". All of this - of course - with localization support and model- 
based, so you don't need custom components. You can also provide  
your own messages on a fall-back fashion (NOT NULL on Foo.bar:  
Dude, you suck! No bar here!, NOT NULL on everything else: Excuse  
me, will you please provide a foo?).


So there.


EOF will throw exceptions in the following order:
1. Formatters on input fields such as date/time and number  
formatters. (Oh, and try and find an easy override for the goop  
this spits out)

2. Validation rules in EOModeler.
3. Property level validators.
4. Operational validators (insert, update, save, delete)

This means that if validation fails in the model your properly  
level and operational level validators are never called.  This is  
one of my biggest complaints about EOF.  I would much prefer that  
number 2 (above) was moved to the end of the list so that custom  
classes get first chance to validate rather than the model.


You can easily create your own class description which does this  
validation before everything else (which is what we do).



That would make a lot more sense in my opinion.


Depends on use case...

Cheers, Anjo


--
Robert Walker
[EMAIL PROTECTED]

There are 10 types of people in the world, those who count in binary,  
and those who don't.



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: Single table inheritance and non-null attributes

2006-12-02 Thread Anjo Krank


Am 01.12.2006 um 21:27 schrieb Robert Walker:

I actually made change a while back that is, indirectly, related to  
this issue.  A simply stopped using any of the validations in the  
EOModel, and I now do all my validation in the custom classes.


This may sound strange, but there is a method to my madness.  I  
want to have control over the validation messages that will be  
displayed  to the user.  Especially when it comes to failures on  
relationship constraints.  Instead of the technobabble that EOModel  
products, I want something more human readable like "Please assign  
the user to a department before saving."  Or changing the default  
string for "not null" to something like "Date cannot be left  
empty.  [Example: 12/01/2006]"


Yaddayadda. Project Wonder. Yadda.

Yawn.

To elaborate some more: we have custom validation parsers since  
basically Day One (cudos to Max for that). We even allow for multi- 
property failures like "you need a Foo if you have a Bar but no Baz".  
All of this - of course - with localization support and model-based,  
so you don't need custom components. You can also provide your own  
messages on a fall-back fashion (NOT NULL on Foo.bar: Dude, you suck!  
No bar here!, NOT NULL on everything else: Excuse me, will you please  
provide a foo?).


So there.


EOF will throw exceptions in the following order:
1. Formatters on input fields such as date/time and number  
formatters. (Oh, and try and find an easy override for the goop  
this spits out)

2. Validation rules in EOModeler.
3. Property level validators.
4. Operational validators (insert, update, save, delete)

This means that if validation fails in the model your properly  
level and operational level validators are never called.  This is  
one of my biggest complaints about EOF.  I would much prefer that  
number 2 (above) was moved to the end of the list so that custom  
classes get first chance to validate rather than the model.


You can easily create your own class description which does this  
validation before everything else (which is what we do).



That would make a lot more sense in my opinion.


Depends on use case...

Cheers, Anjo
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Single table inheritance and non-null attributes

2006-12-01 Thread Robert Walker

Clark,

I actually made change a while back that is, indirectly, related to  
this issue.  A simply stopped using any of the validations in the  
EOModel, and I now do all my validation in the custom classes.


This may sound strange, but there is a method to my madness.  I want  
to have control over the validation messages that will be displayed   
to the user.  Especially when it comes to failures on relationship  
constraints.  Instead of the technobabble that EOModel products, I  
want something more human readable like "Please assign the user to a  
department before saving."  Or changing the default string for "not  
null" to something like "Date cannot be left empty.  [Example:  
12/01/2006]"


EOF will throw exceptions in the following order:
1. Formatters on input fields such as date/time and number  
formatters. (Oh, and try and find an easy override for the goop this  
spits out)

2. Validation rules in EOModeler.
3. Property level validators.
4. Operational validators (insert, update, save, delete)

This means that if validation fails in the model your properly level  
and operational level validators are never called.  This is one of my  
biggest complaints about EOF.  I would much prefer that number 2  
(above) was moved to the end of the list so that custom classes get  
first chance to validate rather than the model.


That would make a lot more sense in my opinion.

On Nov 30, 2006, at 7:09 PM, Mike Schrag wrote:

There was a hug brawl on the WOLips list about whether Entity  
Modeler should change this behavior or not.  Originally I fixed it,  
and there was a great debate and it got removed.  Head over to the  
wolips list to discuss this again.


ms

On Nov 30, 2006, at 6:09 PM, Chuck Hill wrote:



On Nov 30, 2006, at 2:36 PM, Clark Mueller wrote:

I'd definitely be interested... because I noticed that it does  
the same thing, so I assumed there's some reason in particular  
that it's done that way. :-)


In the original EOModeler it was an out and out bug.  I am not  
sure what is up with Entity Modeler.  Maybe Mike was nostalgic for  
some of the old bugs.  :-P


Chuck



What's the workaround?

Thanks,
Clark

On 30 Nov 06, at 3:22 PM, Guido Neitzer wrote:


Am 30.11.2006 um 22:12 schrieb Clark Mueller:

EOModeler generates SQL that results in a table that has ALL of  
the above fields defined as non-null.


This is a known problem. Mike has made a work around for the  
Eclipse Entity Modeler which works fine for me. If you're  
interested, send me a mail.


cug


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill% 
40global-village.net


This email sent to [EMAIL PROTECTED]



--

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve  
specific problems.

http://www.global-village.net/products/practical_webobjects





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag% 
40mdimension.com


This email sent to [EMAIL PROTECTED]



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/robertwalker1% 
40mac.com


This email sent to [EMAIL PROTECTED]


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: Single table inheritance and non-null attributes

2006-11-30 Thread Mike Schrag
There was a hug brawl on the WOLips list about whether Entity Modeler  
should change this behavior or not.  Originally I fixed it, and there  
was a great debate and it got removed.  Head over to the wolips list  
to discuss this again.


ms

On Nov 30, 2006, at 6:09 PM, Chuck Hill wrote:



On Nov 30, 2006, at 2:36 PM, Clark Mueller wrote:

I'd definitely be interested... because I noticed that it does the  
same thing, so I assumed there's some reason in particular that  
it's done that way. :-)


In the original EOModeler it was an out and out bug.  I am not sure  
what is up with Entity Modeler.  Maybe Mike was nostalgic for some  
of the old bugs.  :-P


Chuck



What's the workaround?

Thanks,
Clark

On 30 Nov 06, at 3:22 PM, Guido Neitzer wrote:


Am 30.11.2006 um 22:12 schrieb Clark Mueller:

EOModeler generates SQL that results in a table that has ALL of  
the above fields defined as non-null.


This is a known problem. Mike has made a work around for the  
Eclipse Entity Modeler which works fine for me. If you're  
interested, send me a mail.


cug


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill% 
40global-village.net


This email sent to [EMAIL PROTECTED]



--

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag% 
40mdimension.com


This email sent to [EMAIL PROTECTED]



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Single table inheritance and non-null attributes

2006-11-30 Thread Chuck Hill


On Nov 30, 2006, at 2:36 PM, Clark Mueller wrote:

I'd definitely be interested... because I noticed that it does the  
same thing, so I assumed there's some reason in particular that  
it's done that way. :-)


In the original EOModeler it was an out and out bug.  I am not sure  
what is up with Entity Modeler.  Maybe Mike was nostalgic for some of  
the old bugs.  :-P


Chuck



What's the workaround?

Thanks,
Clark

On 30 Nov 06, at 3:22 PM, Guido Neitzer wrote:


Am 30.11.2006 um 22:12 schrieb Clark Mueller:

EOModeler generates SQL that results in a table that has ALL of  
the above fields defined as non-null.


This is a known problem. Mike has made a work around for the  
Eclipse Entity Modeler which works fine for me. If you're  
interested, send me a mail.


cug


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill% 
40global-village.net


This email sent to [EMAIL PROTECTED]



--

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Single table inheritance and non-null attributes

2006-11-30 Thread Chuck Hill
If you are not using the entity modeler, you will need to edit the  
SQL and allow nulls in these columns.  EOF will perform the checks in  
the app.


Chuck


On Nov 30, 2006, at 2:22 PM, Guido Neitzer wrote:


Am 30.11.2006 um 22:12 schrieb Clark Mueller:

EOModeler generates SQL that results in a table that has ALL of  
the above fields defined as non-null.


This is a known problem. Mike has made a work around for the  
Eclipse Entity Modeler which works fine for me. If you're  
interested, send me a mail.


cug
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill% 
40global-village.net


This email sent to [EMAIL PROTECTED]



--

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Single table inheritance and non-null attributes

2006-11-30 Thread Clark Mueller
I'd definitely be interested... because I noticed that it does the  
same thing, so I assumed there's some reason in particular that it's  
done that way. :-)


What's the workaround?

Thanks,
Clark

On 30 Nov 06, at 3:22 PM, Guido Neitzer wrote:


Am 30.11.2006 um 22:12 schrieb Clark Mueller:

EOModeler generates SQL that results in a table that has ALL of  
the above fields defined as non-null.


This is a known problem. Mike has made a work around for the  
Eclipse Entity Modeler which works fine for me. If you're  
interested, send me a mail.


cug


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Single table inheritance and non-null attributes

2006-11-30 Thread Guido Neitzer

Am 30.11.2006 um 22:12 schrieb Clark Mueller:

EOModeler generates SQL that results in a table that has ALL of the  
above fields defined as non-null.


This is a known problem. Mike has made a work around for the Eclipse  
Entity Modeler which works fine for me. If you're interested, send me  
a mail.


cug
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Single table inheritance and non-null attributes

2006-11-30 Thread Clark Mueller

Hello,

i've been playing with single table inheritance today, and I've run  
across something that I'm curious about. It appears that if I define  
entities like so:


Super:
- id (not null)
- qualifier (not null)

Sub1 (qualifier = 1):
- sub1RequiredAttr (not null)

Sub2 (qualifier = 2):
- sub2RequiredAttr (not null)

EOModeler generates SQL that results in a table that has ALL of the  
above fields defined as non-null. So... what happens at runtime if I  
try to commit a Sub1 or Sub2 to the database? What happens with  
required fields (in the database) that are not a part of a given  
subclass? Does EOF provide some dummy value for those, or do I need  
to handle it in another way?


Thanks & regards,
Clark
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Single-table Inheritance w/ one-to-many

2005-12-25 Thread Arturo Pérez

On Dec 25, 2005, at 5:07 AM, Christian Brunschen wrote:



On 24 Dec 2005, at 23:29, Drew Thoeni wrote:



The problem comes in when I am trying to allow a user to create (or 
edit, but we never get that far) a new record. If no employee has 
more than one sub-class, things are rosey. However, as soon as an 
employee has more than one flag checked (that two or more of these 
are true: isOwner, isConsultant, or isClient), WO believes the wrong 
Class is being returned an gives an error. This error is the result 
of a page where popup fields exist to select an owner, consultant, 
and client to assign to a project.




An object in Java (and indeed most languages) can be of exactly one 
class. It can never be of more, or less, than one class; it can't 
usually even change its class during its lifetime.


Basically, you can't use subclassing and entity inheritance to model 
what you are trying to do.


Read Head First Design Patterns Chapter 10 for the problems with trying 
to model state with inheritance.  You have an object that can be in one 
or more of the states (Owner, Consultant, Client).


You simply need one single Employee class, with the attributes to 
specify what sort of employee it is - isConsultant, isClient. I'd 
actually not have an 'isOwner' attributes, but instead have a 
relationship from the Employee to the project(s) that thsi employee 
owns. If the  employee owns at least one project, then they are per 
definition a project owner.


You may be able to use this approach for all three states.  
Essentially, compose your Employee object out of Owner, Consultant and 
Client objects.  If an Employee has-A Project then it can behave like 
an owner (for that Project), etc.


Good Luck and Happy Holidays.
-arturo

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Single-table Inheritance w/ one-to-many

2005-12-25 Thread Christian Brunschen
On 24 Dec 2005, at 23:29, Drew Thoeni wrote:This question is similar to one I sent a while ago. However, I've changed the structure of my EOmodel and wanted to run this by the group.I have an employee table. An employee can be a project owner, a consultant, or a client. Since an employee at one time or another could be (possibly) all three of these), I have attributes name isOwner, isConsultant, isClient. Since I want users to be able to add an employee one-time, the Employee class is not abstract. I have created sub-classes of Employee called, obviously, Owner, Consultant, and Client. The sub-classes use qualifiers like (isOwner = 1) to select the correct Employees for the sub-class. The Employee table has a qualifier of (employeeID > 0), which is always true and returns all rows.The problem comes in when I am trying to allow a user to create (or edit, but we never get that far) a new record. If no employee has more than one sub-class, things are rosey. However, as soon as an employee has more than one flag checked (that two or more of these are true: isOwner, isConsultant, or isClient), WO believes the wrong Class is being returned an gives an error. This error is the result of a page where popup fields exist to select an owner, consultant, and client to assign to a project.java.lang.IllegalArgumentException: While trying to set the field "consultant" on an object of type ProjectDetailPage we expected a Consultant but received a Client with a value of...Now, I'm sure I'm wrong here, but it seems that the NSArray I have built for owners, consultants, and clients are all separate objects. And just because we have the same employee appearing in two of these NSArrays (say Joe is listed both in owner and consultant), WO should not go wacky and it should just display Joe in the owner popup and the consultant popup.What am I missing?An object in Java (and indeed most languages) can be of exactly one class. It can never be of more, or less, than one class; it can't usually even change its class during its lifetime.Basically, you can't use subclassing and entity inheritance to model what you are trying to do. You simply need one single Employee class, with the attributes to specify what sort of employee it is - isConsultant, isClient. I'd actually not have an 'isOwner' attributes, but instead have a relationship from the Employee to the project(s) that thsi employee owns. If the  employee owns at least one project, then they are per definition a project owner.But just to reiterate: You cannot have an entity whose instances can be of less or more then one class, or whose instances can 'change their class' - because those are not supported states and actions in Java, or in WebObjects.Regards (and Merry Christmas),Best wishes (and Happy Holidays!)Drew// Christian Brunschen ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Single-table Inheritance w/ one-to-many

2005-12-24 Thread Drew Thoeni
This question is similar to one I sent a while ago. However, I've changed the structure of my EOmodel and wanted to run this by the group.I have an employee table. An employee can be a project owner, a consultant, or a client. Since an employee at one time or another could be (possibly) all three of these), I have attributes name isOwner, isConsultant, isClient. Since I want users to be able to add an employee one-time, the Employee class is not abstract. I have created sub-classes of Employee called, obviously, Owner, Consultant, and Client. The sub-classes use qualifiers like (isOwner = 1) to select the correct Employees for the sub-class. The Employee table has a qualifier of (employeeID > 0), which is always true and returns all rows.The problem comes in when I am trying to allow a user to create (or edit, but we never get that far) a new record. If no employee has more than one sub-class, things are rosey. However, as soon as an employee has more than one flag checked (that two or more of these are true: isOwner, isConsultant, or isClient), WO believes the wrong Class is being returned an gives an error. This error is the result of a page where popup fields exist to select an owner, consultant, and client to assign to a project.java.lang.IllegalArgumentException: While trying to set the field "consultant" on an object of type ProjectDetailPage we expected a Consultant but received a Client with a value of...Now, I'm sure I'm wrong here, but it seems that the NSArray I have built for owners, consultants, and clients are all separate objects. And just because we have the same employee appearing in two of these NSArrays (say Joe is listed both in owner and consultant), WO should not go wacky and it should just display Joe in the owner popup and the consultant popup.What am I missing?Regards (and Merry Christmas),Drew ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: Multiple many-to-many with single-table inheritance

2005-12-05 Thread David Avendasora

Drew,

I can see why you want to do this, but you should at least consider  
making this a many-to-many relationship as well.


While using this powers-of-two system will allow you to easily embed  
many Types with a single to-one relationship, you will need code that  
can recognize any possible combination. With only three types it's  
pretty straight forward, but as the number of Types increase the  
number of possible combinations increases exponentially and writing  
code to parse the integer value into Types will get ugly.


I suggest using the same design pattern as option 2. Create an  
intermediate class of EmployeeType that will have one instance for  
each Type the Employee can be. You will still be able to select only  
the Employees that have a type of Consultant and the code will be  
much more transparent while debugging and for the next coder to come  
along (or when you have to make revisions to it in 4 years).


Dave

On Dec 4, 2005, at 6:57 PM, Drew Thoeni wrote:

I'm giving that a shot and will see how well it works. One oddity  
about this is that an employee can be more than one of these things  
(they can be a project owner on one project, and a project manager  
on another. So I'm using a type code as part of the qualifier that  
allows the employee attribute of "type" to have a coded integer  
value where 1=owner, 2=consultant, 4=manager. This allows for a  
type of 3 = owner or consultant.


What I'm trying to do is build a pop-up list showing only those  
employees that could possibly be a consultant. The qualifier for  
the consultant subclass is ((type=2) or (type=3)).


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Multiple many-to-many with single-table inheritance

2005-12-04 Thread Drew Thoeni

David,

Thanks. Upon researching this more, and contemplating your option #2,  
it seems that what would really suite the needs of this problem is  
"single-table mapping."


http://developer.apple.com/documentation/WebObjects/UsingEOModeler/ 
7ModelingInheritance/chapter_7_section_5.html#//apple_ref/doc/uid/ 
TP30001018-CH207-CACJFAHB


I'm giving that a shot and will see how well it works. One oddity  
about this is that an employee can be more than one of these things  
(they can be a project owner on one project, and a project manager on  
another. So I'm using a type code as part of the qualifier that  
allows the employee attribute of "type" to have a coded integer value  
where 1=owner, 2=consultant, 4=manager. This allows for a type of 3 =  
owner or consultant.


What I'm trying to do is build a pop-up list showing only those  
employees that could possibly be a consultant. The qualifier for the  
consultant subclass is ((type=2) or (type=3)).


Drew
On Dec 4, 2005, at 2:37 AM, David Avendasora wrote:

I don't believe you need 3 many-to-many joins. There are three  
different ways to handle this each with their own benefits/drawbacks.


1) Three to-one relationships:

- With the classes and attributes that you already have, create the  
following to-one relationships

  - Project.projectOwnerID -> Employee.employeeID
  - Project.consulatantID -> Employee.employeeID
  - Project.projectManagerID -> Employee.employeeID

The benefit of this method is that it is very easy to get the  
related objects with getOwner() getProjectManager() etc. but this  
restricts you to only one of each Owner, Consultant and Manager  
(which may be valid for Owner and Manager, but almost certainly not  
for Consultant).


2) One Many-to-Many relationship:

- Remove the three Employee attributes from the Project class.
- Create an intermediate class of ProjectEmployee with the  
following attributes

  - projectEmployeeID (PK)
  - projectID
  - employeeID
  - projectEmployeeTypeID
- Create type class of ProjectEmployeeType with the following  
attributes

  - projectEmployeeTypeID
  - typeName
- Create the following to-many relationships
  - Project.projectID -> ProjectEmployee.projectID
  - Employee.employeeID -> ProjectEmployee.employeeID
  - ProjectEmployeeType.projectEmployeeTypeID ->  
ProjectEmployee.projectEmployeeTypeID

- Create the following to-one relationships
  - ProjectEmployee.projectID -> Project.projectID
  - ProjectEmployee.employeeID -> Employee.employeeID
  - ProjectEmployee.projectEmployeeTypeID ->  
rojectEmployeeType.projectEmployeeTypeID


This gives you the most flexibility and the most "normalized"  
database. You can have any number of Owners, Consultants and  
Managers (may or may-not fit your business-logic) and you can  
easily add new "types" of employees to the Project-Employee  
relationship by simply creating new types. There's no need to  
change the data-structure or the classes.


The drawback is that it makes the simple things like  
Project.getOwner() method more involved because this method will  
not exist unless you create it. You will have a getEmployees()  
method and you'll need to modify it so you can pass the type you  
are requesting line getEmployees("Owner") or something like that.  
Again, you can write individual methods like getOwner() to hide  
this extra work, but it is work you wouldn't need to do if you used  
to-one relationships.


3) One (or two) to-one relationships and one to-one relationship.

- If you KNOW you will only have one owner and/or one Manager, then
  - keep those relationships as to-one as outlined above in option 1
  - make the Consultants relationship to-many as outlined in option  
2 (Eliminate the ProjectEmployeeType class and relationships)


This gives you easier to read and understand object and data models  
and code, but is still quite inflexible.


I personally almost always use option 2 as it reduces the impact of  
most common changes to the system that that WILL happen. When your  
customer decides that you really need to have multiple Owners or  
that each Project also has a Business Analyst or that Consultant is  
just too generic. Option 2 makes all of these changes trivial where  
options 1 and 3 force you to make major changes to the classes and  
database. Up-front it's a little more work, but in the long run, it  
will save you a LOT.


Hope this helps!

Dave


On Dec 4, 2005, at 5:00 AM, Drew Thoeni wrote:


I have a set of two objects:

Project
Employee

The Project has three attributes that relate to Employee:

projectOwnerID
consultantID
projectManagerID

I'd like to use single-table inheritance and have Employee with  
children.


It is unclear to me how to create three many-to-many joins in  
EOModeler between the two Objects (Project and Employee).


Is this possible? I can create the first one

Re: Multiple many-to-many with single-table inheritance

2005-12-04 Thread Amedeo Mantica

please explain better
can you add a EOmodeler graphical view screenshot?

amedeo

On 04/dic/05, at 06:00, Drew Thoeni wrote:


I have a set of two objects:

Project
Employee

The Project has three attributes that relate to Employee:

projectOwnerID
consultantID
projectManagerID

I'd like to use single-table inheritance and have Employee with  
children.


It is unclear to me how to create three many-to-many joins in  
EOModeler between the two Objects (Project and Employee).


Is this possible? I can create the first one using "Join in Many-to- 
Many", but adding the next fails as EOModeler has already created a  
flattened relationship for "projects" and "employees."


The best idea I have is to rename the relationships from  
"employees" to "owners", "consultants", and "projectManagers" and  
rename the other side as "ownerProjects", "consultantProjects", and  
"projectManagerProjects."


Is this the proper method?

Regards,

Drew
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/amedeo% 
40macintossicati.com


This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Multiple many-to-many with single-table inheritance

2005-12-04 Thread David Avendasora
I don't believe you need 3 many-to-many joins. There are three  
different ways to handle this each with their own benefits/drawbacks.


1) Three to-one relationships:

- With the classes and attributes that you already have, create the  
following to-one relationships

  - Project.projectOwnerID -> Employee.employeeID
  - Project.consulatantID -> Employee.employeeID
  - Project.projectManagerID -> Employee.employeeID

The benefit of this method is that it is very easy to get the related  
objects with getOwner() getProjectManager() etc. but this restricts  
you to only one of each Owner, Consultant and Manager (which may be  
valid for Owner and Manager, but almost certainly not for Consultant).


2) One Many-to-Many relationship:

- Remove the three Employee attributes from the Project class.
- Create an intermediate class of ProjectEmployee with the following  
attributes

  - projectEmployeeID (PK)
  - projectID
  - employeeID
  - projectEmployeeTypeID
- Create type class of ProjectEmployeeType with the following attributes
  - projectEmployeeTypeID
  - typeName
- Create the following to-many relationships
  - Project.projectID -> ProjectEmployee.projectID
  - Employee.employeeID -> ProjectEmployee.employeeID
  - ProjectEmployeeType.projectEmployeeTypeID ->  
ProjectEmployee.projectEmployeeTypeID

- Create the following to-one relationships
  - ProjectEmployee.projectID -> Project.projectID
  - ProjectEmployee.employeeID -> Employee.employeeID
  - ProjectEmployee.projectEmployeeTypeID ->  
rojectEmployeeType.projectEmployeeTypeID


This gives you the most flexibility and the most "normalized"  
database. You can have any number of Owners, Consultants and Managers  
(may or may-not fit your business-logic) and you can easily add new  
"types" of employees to the Project-Employee relationship by simply  
creating new types. There's no need to change the data-structure or  
the classes.


The drawback is that it makes the simple things like Project.getOwner 
() method more involved because this method will not exist unless you  
create it. You will have a getEmployees() method and you'll need to  
modify it so you can pass the type you are requesting line  
getEmployees("Owner") or something like that. Again, you can write  
individual methods like getOwner() to hide this extra work, but it is  
work you wouldn't need to do if you used to-one relationships.


3) One (or two) to-one relationships and one to-one relationship.

- If you KNOW you will only have one owner and/or one Manager, then
  - keep those relationships as to-one as outlined above in option 1
  - make the Consultants relationship to-many as outlined in option  
2 (Eliminate the ProjectEmployeeType class and relationships)


This gives you easier to read and understand object and data models  
and code, but is still quite inflexible.


I personally almost always use option 2 as it reduces the impact of  
most common changes to the system that that WILL happen. When your  
customer decides that you really need to have multiple Owners or that  
each Project also has a Business Analyst or that Consultant is just  
too generic. Option 2 makes all of these changes trivial where  
options 1 and 3 force you to make major changes to the classes and  
database. Up-front it's a little more work, but in the long run, it  
will save you a LOT.


Hope this helps!

Dave


On Dec 4, 2005, at 5:00 AM, Drew Thoeni wrote:


I have a set of two objects:

Project
Employee

The Project has three attributes that relate to Employee:

projectOwnerID
consultantID
projectManagerID

I'd like to use single-table inheritance and have Employee with  
children.


It is unclear to me how to create three many-to-many joins in  
EOModeler between the two Objects (Project and Employee).


Is this possible? I can create the first one using "Join in Many-to- 
Many", but adding the next fails as EOModeler has already created a  
flattened relationship for "projects" and "employees."


The best idea I have is to rename the relationships from  
"employees" to "owners", "consultants", and "projectManagers" and  
rename the other side as "ownerProjects", "consultantProjects", and  
"projectManagerProjects."


Is this the proper method?

Regards,

Drew
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects% 
40avendasora.com


This email sent to [EMAIL PROTECTED]




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Multiple many-to-many with single-table inheritance

2005-12-03 Thread Drew Thoeni

I have a set of two objects:

Project
Employee

The Project has three attributes that relate to Employee:

projectOwnerID
consultantID
projectManagerID

I'd like to use single-table inheritance and have Employee with  
children.


It is unclear to me how to create three many-to-many joins in  
EOModeler between the two Objects (Project and Employee).


Is this possible? I can create the first one using "Join in Many-to- 
Many", but adding the next fails as EOModeler has already created a  
flattened relationship for "projects" and "employees."


The best idea I have is to rename the relationships from "employees"  
to "owners", "consultants", and "projectManagers" and rename the  
other side as "ownerProjects", "consultantProjects", and  
"projectManagerProjects."


Is this the proper method?

Regards,

Drew
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com