D2W Wonder with multiple EOModels
Hello, I apologize if this is a duplicate my apple lists account appeared to be messed up so I resubscribed; I have a D2W application with two EOModels that connect to two different databases.EOF works correctly to pull the data for both models, I turned on EOF debugging and I see records being returned when the entries are selected and queried. For example: ( I removed some of the columns text to make it easier to read) Oct 11 21:04:52 mozaic[5001] DEBUG NSLog - === Begin Internal Transaction Oct 11 21:04:52 mozaic[5001] DEBUG NSLog - evaluateExpression: Oct 11 21:04:52 mozaic[5001] DEBUG NSLog - 412 row(s) processed The task is LIST. For any entity in the first EOModel the list template works fine and data is listed in the page. For any entity in the second EOModel the list template loads but says there are no records. But as you can see above, 412 records have been returned from the database for ITABYY and when it is selected and searched with no criteria nothing displays in the list page. Every entity in the second EOModel will not display in the list template. If I query the EOF directly I get all the records back that I would respect. Have I missed a step when using multiple Models? Thanks, Don ___ 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: EOFetchSpecification prefetching and Multiple EOModels
Hi Travis, On Mar 11, 2009, at 2:43 PM, Travis Britt wrote: On Mar 11, 2009, at 1:37 PM, David Avendasora wrote: Am I the first to ever prefetch a cross-model relationship? Nope! I also confirmed this behavior about a year ago between two Oracle databases. If you don't prefetch on those keypaths the EOs do get faulted in properly, albeit one at a time. I was able to work around it at the time by doing a 2nd explicit fetch for the relationship. Yep. My experience, exactly. I got as far as hooking up a EODatabaseContext subclass so I could monitor what happens in EODatabaseContext.batchFetchRelationship(), but by the time that is called it appeared that EOF believes the fault had already been fired and is empty. Did you happen to file a bug with Apple? I'd like to add it to mine so that it might have a better chance of getting fixed. Dave ___ 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: EOFetchSpecification prefetching and Multiple EOModels
On Mar 12, 2009, at 6:39 AM, David Avendasora wrote: I got as far as hooking up a EODatabaseContext subclass so I could monitor what happens in EODatabaseContext.batchFetchRelationship(), but by the time that is called it appeared that EOF believes the fault had already been fired and is empty. Did you happen to file a bug with Apple? I'd like to add it to mine so that it might have a better chance of getting fixed. I can't remember, it does not appear that I did so I just opened another one: 6674703. tb ___ 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
EOFetchSpecification prefetching and Multiple EOModels
Hi all, I've run into something that I haven't been able to find documented anywhere, but does seem to fit with other Cross-Model relationship issues (http://lists.apple.com/archives/Webobjects-dev/2008/Dec/msg00058.html ). If you have a cross-model relationship, you can't prefetch the relationship when constructing an EOFetchSpecification. It will simply return null, or an empty NSArray if it is a to-many relationship. Subsequent calls to the relationship simply return null or the empty NSArray. Is this the expected behavior? It seems logical, but unexpected to me (Yes, those two concepts can coexist simultaneously in my brain). Dave ___ 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: EOFetchSpecification prefetching and Multiple EOModels
On Mar 11, 2009, at 12:46 PM, David Avendasora wrote: Hi all, I've run into something that I haven't been able to find documented anywhere, but does seem to fit with other Cross-Model relationship issues (http://lists.apple.com/archives/Webobjects-dev/2008/Dec/msg00058.html ). If you have a cross-model relationship, you can't prefetch the relationship when constructing an EOFetchSpecification. It will simply return null, or an empty NSArray if it is a to-many relationship. Subsequent calls to the relationship simply return null or the empty NSArray. I should clarify. The FS returns an NSArray of EOs as you'd expect, but each of those EO's prefetched cross-model relationship is null or an empty NSArray. Is this the expected behavior? It seems logical, but unexpected to me (Yes, those two concepts can coexist simultaneously in my brain). Dave ___ 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: EOFetchSpecification prefetching and Multiple EOModels
On Mar 11, 2009, at 9:46 AM, David Avendasora wrote: Hi all, I've run into something that I haven't been able to find documented anywhere, but does seem to fit with other Cross-Model relationship issues (http://lists.apple.com/archives/Webobjects-dev/2008/Dec/msg00058.html ). If you have a cross-model relationship, Same database or different database? you can't prefetch the relationship when constructing an EOFetchSpecification. It will simply return null, or an empty NSArray if it is a to-many relationship. I think that would be a bug. Prefetching is a separate select so it should not matter if it is in a different database. Subsequent calls to the relationship simply return null or the empty NSArray. Which is clearly a bug if they return proper results normally. Is this the expected behavior? No to me. It seems logical, but unexpected to me (Yes, those two concepts can coexist simultaneously in my brain). I don't find that surprising in the least! ;-) 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: EOFetchSpecification prefetching and Multiple EOModels
On Mar 11, 2009, at 1:20 PM, Chuck Hill wrote: On Mar 11, 2009, at 9:46 AM, David Avendasora wrote: Hi all, I've run into something that I haven't been able to find documented anywhere, but does seem to fit with other Cross-Model relationship issues (http://lists.apple.com/archives/Webobjects-dev/2008/Dec/msg00058.html ). If you have a cross-model relationship, Same database or different database? It is a different database. It happens to reside on the same DB server, but there's no guarantee that that will be the case long term. you can't prefetch the relationship when constructing an EOFetchSpecification. It will simply return null, or an empty NSArray if it is a to-many relationship. I think that would be a bug. Prefetching is a separate select so it should not matter if it is in a different database. I thought it would do a separate select, but using a join to get only the related EOs. Otherwise how would it know which records to select? If it is a cross-DB join, then EOF (or the DB plugin - MSSQL in this case) would need to add the Server and Database name to the table names in the SQL such as: SELECT T2.column1, T2.column2, T3.etc FROM Server1.WO.dbo.table T1, Server2.GP.dbo.table1 T2 WHERE T1.pkColumn = T2.fkColumn Subsequent calls to the relationship simply return null or the empty NSArray. Which is clearly a bug if they return proper results normally. Yep. I took out the prefetch path for the cross-model relationship and now when relationship() is called on one of the fetched EOs a round- trip to the database is done and I get exactly what I would expect. Is this the expected behavior? No to me. Am I the first to ever prefetch a cross-model relationship?! I would think that those would be prime candidates for prefetching, especially if it is a different DB server. Or is this a case of the Microsoft DB plugin just not handling the relationship properly? Dave ___ 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: EOFetchSpecification prefetching and Multiple EOModels
you can't prefetch the relationship when constructing an EOFetchSpecification. It will simply return null, or an empty NSArray if it is a to-many relationship. I think that would be a bug. Prefetching is a separate select so it should not matter if it is in a different database. you'd think so ... but this does definitely fail ... i tracked down why a few months back but it was REALLY buried in EOF and hard to fix in Wonder. log a radar, definitely. 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: EOFetchSpecification prefetching and Multiple EOModels
On Mar 11, 2009, at 1:47 PM, Mike Schrag wrote: you can't prefetch the relationship when constructing an EOFetchSpecification. It will simply return null, or an empty NSArray if it is a to-many relationship. I think that would be a bug. Prefetching is a separate select so it should not matter if it is in a different database. you'd think so ... but this does definitely fail ... i tracked down why a few months back but it was REALLY buried in EOF and hard to fix in Wonder. log a radar, definitely. Done. 6670233 Dave ___ 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: EOFetchSpecification prefetching and Multiple EOModels
On Mar 11, 2009, at 10:37 AM, David Avendasora wrote: On Mar 11, 2009, at 1:20 PM, Chuck Hill wrote: On Mar 11, 2009, at 9:46 AM, David Avendasora wrote: Hi all, I've run into something that I haven't been able to find documented anywhere, but does seem to fit with other Cross-Model relationship issues (http://lists.apple.com/archives/Webobjects-dev/2008/Dec/msg00058.html ). If you have a cross-model relationship, Same database or different database? It is a different database. It happens to reside on the same DB server, but there's no guarantee that that will be the case long term. you can't prefetch the relationship when constructing an EOFetchSpecification. It will simply return null, or an empty NSArray if it is a to-many relationship. I think that would be a bug. Prefetching is a separate select so it should not matter if it is in a different database. I thought it would do a separate select, but using a join to get only the related EOs. Otherwise how would it know which records to select? If it is a cross-DB join, then EOF (or the DB plugin - MSSQL in this case) would need to add the Server and Database name to the table names in the SQL such as: SELECT T2.column1, T2.column2, T3.etc FROM Server1.WO.dbo.table T1, Server2.GP.dbo.table1 T2 WHERE T1.pkColumn = T2.fkColumn SELECT T2.column1, T2.column2, T3.etc FROM Server2.GP.dbo.table1 T2 WHERE T2.fkColumn in (...) Which is s rewriting of the qualifier not the normal migration from one entity to another so perhaps that is why it does not work. Subsequent calls to the relationship simply return null or the empty NSArray. Which is clearly a bug if they return proper results normally. Yep. I took out the prefetch path for the cross-model relationship and now when relationship() is called on one of the fetched EOs a round-trip to the database is done and I get exactly what I would expect. Is this the expected behavior? No to me. Am I the first to ever prefetch a cross-model relationship?! Possibly. I would think that those would be prime candidates for prefetching, especially if it is a different DB server. Or is this a case of the Microsoft DB plugin just not handling the relationship properly? I'd guess this is in EOF not the plugin. 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: EOFetchSpecification prefetching and Multiple EOModels
On Mar 11, 2009, at 1:37 PM, David Avendasora wrote: Am I the first to ever prefetch a cross-model relationship? Nope! I also confirmed this behavior about a year ago between two Oracle databases. If you don't prefetch on those keypaths the EOs do get faulted in properly, albeit one at a time. I was able to work around it at the time by doing a 2nd explicit fetch for the relationship. I got as far as hooking up a EODatabaseContext subclass so I could monitor what happens in EODatabaseContext.batchFetchRelationship(), but by the time that is called it appeared that EOF believes the fault had already been fired and is empty. tb ___ 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: Multiple EOModels
Thanks for that, obviously frameworks are the way to go, I haven't really needed to make my own up to now but clearly I should have :-) Back to the bookshelf then :-) Regards, David. On 27 Mar 2008, at 18:52, Chuck Hill wrote: On Mar 27, 2008, at 1:57 AM, David Griffith wrote: Hi all, I have two apps that have two distinct EOModels. I now need to link these two apps so that they have access to each other's data, so I was going to add both models to each app and recompile. Frameworks. You want frameworks. Frameworks are WebObjects (and, well, OS X's) way of sharing things between applications. Put the models and the related code in a framework and use the framework in the application. I _never_ _ever_ put a model in an application. However, it transpires that both models have a couple of entity names in common. Are they the same entity (same database, same table)? If so, create a framework and model to hold the common entities. Use this framework in the frameworks holding the models with the other entities. Include all three frameworks in your application. If they are not the same entity but just happen to have the same name, then you need to rename one of them. I can understand why this would cause a problem, what I need to know is if there is a way around this without having to completely rename the entities in one of the models. The other strange thing is that it tells me there is a name conflict between the EOPrototypes entity in each model, but I don't think there is any other way to name this entity, correct? You probably guessed this already, but framework. The prototypes go into a model by themselves and this framework is included in (referenced in) the frameworks that have models and in the application. Thus Application - Prototypes framework - Common entities framework - Other EO framework 1 - Other EO framework 2 Chuck -- 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]
Multiple EOModels
Hi all, I have two apps that have two distinct EOModels. I now need to link these two apps so that they have access to each other's data, so I was going to add both models to each app and recompile. However, it transpires that both models have a couple of entity names in common. I can understand why this would cause a problem, what I need to know is if there is a way around this without having to completely rename the entities in one of the models. The other strange thing is that it tells me there is a name conflict between the EOPrototypes entity in each model, but I don't think there is any other way to name this entity, correct? Kind regards, David. ___ 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: Multiple EOModels
from the EOModelGroup docs: The default model group contains all models for an application, as well as any frameworks the application references. It is automatically created on demand. The entity name space among all of these models is global; consequently, the same entity name shouldn't appear in any two of the models. All cross-model information is represented in the models by entity name only. Binding the entity name to an actual entity is done at run-time within the EOModelGroup. so rather than using the default group you could programatically create a model group for each model. i believe you can then access each model from within your app, but you can't create relationships between the models because they are in different groups. this of course presumes you have the common entities in different packages. if you are using the default package, well, you shouldn't be :-) Note i'm no expert on this - i've little experience with multiple models in one app - but i'm sure someone will correct me if i'm talking rubbish :-) Simon On 27 Mar 2008, at 08:57, David Griffith wrote: However, it transpires that both models have a couple of entity names in common. I can understand why this would cause a problem, what I need to know is if there is a way around this without having to completely rename the entities in one of the models. ___ 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: Multiple EOModels
I have two apps that have two distinct EOModels. I now need to link these two apps so that they have access to each other's data, so I was going to add both models to each app and recompile. However, it transpires that both models have a couple of entity names in common. I can understand why this would cause a problem, what I need to know is if there is a way around this without having to completely rename the entities in one of the models. I think you have to use a prefix or similar mechanism. Like DDUser, DDGroups, FFUser, etc... This should only be needed on the entity names, we usually organize the java classes in packages instead of using prefixes in java names. The other strange thing is that it tells me there is a name conflict between the EOPrototypes entity in each model, but I don't think there is any other way to name this entity, correct? The prototypes should probably be factored in to a 3rd model. Cheers Tonny Kind regards, David. ___ 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/mezz.dk%40gmail.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: Multiple EOModels
On Mar 27, 2008, at 1:57 AM, David Griffith wrote: Hi all, I have two apps that have two distinct EOModels. I now need to link these two apps so that they have access to each other's data, so I was going to add both models to each app and recompile. Frameworks. You want frameworks. Frameworks are WebObjects (and, well, OS X's) way of sharing things between applications. Put the models and the related code in a framework and use the framework in the application. I _never_ _ever_ put a model in an application. However, it transpires that both models have a couple of entity names in common. Are they the same entity (same database, same table)? If so, create a framework and model to hold the common entities. Use this framework in the frameworks holding the models with the other entities. Include all three frameworks in your application. If they are not the same entity but just happen to have the same name, then you need to rename one of them. I can understand why this would cause a problem, what I need to know is if there is a way around this without having to completely rename the entities in one of the models. The other strange thing is that it tells me there is a name conflict between the EOPrototypes entity in each model, but I don't think there is any other way to name this entity, correct? You probably guessed this already, but framework. The prototypes go into a model by themselves and this framework is included in (referenced in) the frameworks that have models and in the application. Thus Application - Prototypes framework - Common entities framework - Other EO framework 1 - Other EO framework 2 Chuck -- 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]
Multiple EOModels Servlets
Hi all, I'm getting the following error: [2008-02-08 16:11:42,847] http-8080-2 NSLog$Log4JLogger - An exception occurred while trying to open a channel: com.webobjects.jdbcadaptor.JDBCAdaptorException: Found multiple data sources. Please map the EOModels to a data source explicitly! How do you explicitly tie a EOModel to a servlet datasource? Thanks, Dave ___ 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: Multiple EOModels Servlets
Okay, I figured it out. In my Context.xml file (which Tomcat copies and renames to the conf/ Catalina/localhost/MyApp.xml upon startup, the datasource Resource name parameters have to match the name of the EOModel. So, if your model is named MyApp.eomodel, the data source name parameter must be MyModel Example: Model file named: MyModel.eomodel Context.xml/MyApp.xml: Resource auth=Container description=MyApp Data Source name=MyModel type=javax.sql.DataSource driverClassName=com.microsoft.jdbc.sqlserver.SQLServerDriver url=jdbc:microsoft:sqlserver://serveraddress:1433;databaseName=TEST username=user password=pass maxActive=4 maxWait=5000 maxIdle=10 / Hope this helps someone else (or my future self)! Dave On Feb 8, 2008, at 4:21 PM, David Avendasora wrote: Hi all, I'm getting the following error: [2008-02-08 16:11:42,847] http-8080-2 NSLog$Log4JLogger - An exception occurred while trying to open a channel: com.webobjects.jdbcadaptor.JDBCAdaptorException: Found multiple data sources. Please map the EOModels to a data source explicitly! How do you explicitly tie a EOModel to a servlet datasource? Thanks, Dave ___ 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 [EMAIL PROTECTED]