This is now biting me. I have the following:
public static ERXEnterpriseObjectCache<Airport> cacheByPrimaryKey = new ERXEnterpriseObjectCache<Airport>(Airport.ENTITY_NAME, "primaryKey", // Cache Key null, // qualifier 300000L, // timeout - 0=never true, // shouldRetainObjects true, // shouldFetchInitialValues false); // shouldReturnUnsavedObjects Which is tripping the same bug. Why, oh why, does SQL generation need to initialize the EO’s class?? Shouldn’t the EOClassDescription or EOGenericRecord be enough? I don’t see what getting the actual class accomplishes, other than make SQL Generation more fragile. If ERXEnterpriseObjectCache breaks it, what else can? Yes, I’m second-guessing Mike Schrag. (Hi Mike) So, Mike, is this something that is possible to change (yes, I know it would be on me to do it - be afraid) or is there something about how the sql generation works that requires more than the Entity itself? Thanks, Dave On Oct 26, 2011, at 5:19 PM, Chuck Hill <ch...@global-village.net> wrote: > The fundamental issue is that ERXEnterpriseObjectCache is intended to be used > in a Wonder application, where those properties are read and used. > Generating SQL only loads the classes, it does not run in the context of a > running WO application. > > You probably DO want to retain the objects, you just don't want to initialize > this in a static block. Use lazy initialization so that the class can load > without setting up the cache. > > > Chuck > > > On 2011-10-26, at 2:16 PM, Issam Maamria wrote: > >> Thanks Chuck for the pointer. >> >> The issue was in a static initialiser that executes the following line in >> its call trace: >> new ERXEnterpriseObjectCache<XXX>(entityName, XXX.NAME_KEY, null, >> CACHE_TIMEOUT, true, false, false); >> >> I changed the argument 'shouldRetainObjects''s value from true to false, and >> it did the trick. >> >> However, I do not fully understand what was the fundamental issue! >> >> Regards >> >> Issam >> >> On 26 October 2011 19:26, Chuck Hill <ch...@global-village.net> wrote: >> Hi Issam, >> >> It is a bad idea to do anything in the constructor of an EO, which I assume >> is what is happening here: >> >> >>> at >>> er.extensions.eof.ERXEnterpriseObjectCache.setRetainObjects(ERXEnterpriseObjectCache.java:789) >>> at >>> er.extensions.eof.ERXEnterpriseObjectCache.<init>(ERXEnterpriseObjectCache.java:201) >>> at indoc.app.common.IDStaticTag.tagCacheForEntity(IDStaticTag.java:75) >>> at indoc.app.common.IDStaticTag.<init>(IDStaticTag.java:61) >>> at indoc.app.entities.Content.<clinit>(Content.java:39) >> >> This can often cause EOF problems. A better choice is to use lazy >> initialization. >> http://en.wikipedia.org/wiki/Lazy_initialization >> >> >> Chuck >> >> >> On 2011-10-26, at 11:00 AM, Issam Maamria wrote: >> >>> Hi all, >>> >>> Thank you very much for the pointers. They, however, were not the cause of >>> the problem. >>> >>> An interesting thing is that the following exception always happens before >>> the one I mentioned before. >>> >>> I have the following lines in my properties file: >>> >>> # EOF >>> >>> er.extensions.ERXEC.safeLocking=true >>> >>> er.extensions.ERXEC.useSharedEditingContext=false >>> >>> er.extensions.ERXEC.markOpenLocks = false >>> >>> er.extensions.ERXEC.traceOpenLocks = false >>> >>> >>> >>> er.extensions.ERXEnterpriseObject.applyRestrictingQualifierOnInsert=true >>> >>> er.extensions.ERXEnterpriseObject.updateInverseRelationships=true >>> >>> The trace is : >>> >>> java.lang.ExceptionInInitializerError >>> at java.lang.Class.forName0(Native Method) >>> at java.lang.Class.forName(Class.java:169) >>> at >>> com.webobjects.foundation._NSUtilities._classWithPartialName(_NSUtilities.java:348) >>> at >>> com.webobjects.foundation._NSUtilities.classWithName(_NSUtilities.java:335) >>> at >>> com.webobjects.eoaccess.EOModel._setEntityForEntityNameClassName(EOModel.java:1299) >>> at >>> com.webobjects.eoaccess.EOModel._addFakeEntityWithPropertyList(EOModel.java:1337) >>> at >>> com.webobjects.eoaccess.EOModel._initWithTableOfContentsPropertyListPathURL(EOModel.java:1141) >>> at com.webobjects.eoaccess.EOModel.<init>(EOModel.java:838) >>> at >>> com.webobjects.eoaccess.EOModelGroup.addModelWithPathURL(EOModelGroup.java:443) >>> at >>> org.objectstyle.wolips.eomodeler.core.sql.EOFSQLGenerator53.<init>(EOFSQLGenerator53.java:121) >>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >>> Method) >>> at >>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) >>> at >>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) >>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513) >>> at >>> org.objectstyle.wolips.eomodeler.core.sql.EOFSQLGeneratorFactory.sqlGenerator(EOFSQLGeneratorFactory.java:43) >>> at >>> org.objectstyle.wolips.eomodeler.actions.GenerateSQLDialog.generateSql(GenerateSQLDialog.java:297) >>> at >>> org.objectstyle.wolips.eomodeler.actions.GenerateSQLDialog$1.run(GenerateSQLDialog.java:279) >>> at java.lang.Thread.run(Thread.java:680) >>> Caused by: java.lang.RuntimeException: ERXEnterpriseObjectCache requires >>> automatic locking when objects are retained. Set >>> er.extensions.ERXEC.defaultAutomaticLockUnlock or >>> er.extensions.ERXEC.safeLocking in your Properties file >>> at >>> er.extensions.eof.ERXEnterpriseObjectCache.setRetainObjects(ERXEnterpriseObjectCache.java:789) >>> at >>> er.extensions.eof.ERXEnterpriseObjectCache.<init>(ERXEnterpriseObjectCache.java:201) >>> at indoc.app.common.IDStaticTag.tagCacheForEntity(IDStaticTag.java:75) >>> at indoc.app.common.IDStaticTag.<init>(IDStaticTag.java:61) >>> at indoc.app.entities.Content.<clinit>(Content.java:39) >>> ... 18 more >>> >>> Regards >>> >>> Issam >>> >>> On 26 October 2011 16:51, Chuck Hill <ch...@global-village.net> wrote: >>> static initialization blocks can also cause problems for SQL generation - >>> check that they are not throwing exceptions. >>> >>> On 2011-10-26, at 7:15 AM, John Huss wrote: >>> >>>> The classes that you declare for you entities must be reachable from the >>>> project where the model is located, usually in the same project. >>>> >>>> On Wed, Oct 26, 2011 at 6:19 AM, Issam Maamria <maam...@gmail.com> wrote: >>>> Hi all, >>>> >>>> I have an issue with SQL generation from an EOModel. The thing is it >>>> sometimes works (this happens randomly), and most of the time comes up >>>> with an error: >>>> >>>> java.lang.NoClassDefFoundError: Could not initialize class XXXXXXXX >>>> at java.lang.Class.forName0(Native Method) >>>> at java.lang.Class.forName(Class.java:169) >>>> at >>>> com.webobjects.foundation._NSUtilities._classWithPartialName(_NSUtilities.java:348) >>>> at >>>> com.webobjects.foundation._NSUtilities.classWithName(_NSUtilities.java:335) >>>> at >>>> com.webobjects.eoaccess.EOModel._setEntityForEntityNameClassName(EOModel.java:1299) >>>> at >>>> com.webobjects.eoaccess.EOModel._addFakeEntityWithPropertyList(EOModel.java:1337) >>>> at >>>> com.webobjects.eoaccess.EOModel._initWithTableOfContentsPropertyListPathURL(EOModel.java:1141) >>>> at com.webobjects.eoaccess.EOModel.<init>(EOModel.java:838) >>>> at >>>> com.webobjects.eoaccess.EOModelGroup.addModelWithPathURL(EOModelGroup.java:443) >>>> at >>>> org.objectstyle.wolips.eomodeler.core.sql.EOFSQLGenerator53.<init>(EOFSQLGenerator53.java:121) >>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >>>> Method) >>>> at >>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) >>>> at >>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) >>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513) >>>> at >>>> org.objectstyle.wolips.eomodeler.core.sql.EOFSQLGeneratorFactory.sqlGenerator(EOFSQLGeneratorFactory.java:43) >>>> at >>>> org.objectstyle.wolips.eomodeler.actions.GenerateSQLDialog.generateSql(GenerateSQLDialog.java:297) >>>> at >>>> org.objectstyle.wolips.eomodeler.actions.GenerateSQLDialog$1.run(GenerateSQLDialog.java:279) >>>> at java.lang.Thread.run(Thread.java:680) >>>> >>>> SQL generation is a GREAT feature, and it is frustrating that I cannot get >>>> it to work on a consistent basis. >>>> >>>> Regards >>>> >>>> Issam >>>> >>>> ------------------------------------------------------------------------------ >>>> The demand for IT networking professionals continues to grow, and the >>>> demand for specialized networking skills is growing even more rapidly. >>>> Take a complimentary Learning@Cisco Self-Assessment and learn >>>> about Cisco certifications, training, and career opportunities. >>>> http://p.sf.net/sfu/cisco-dev2dev >>>> _______________________________________________ >>>> Wonder-disc mailing list >>>> wonder-d...@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/wonder-disc >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> The demand for IT networking professionals continues to grow, and the >>>> demand for specialized networking skills is growing even more rapidly. >>>> Take a complimentary Learning@Cisco Self-Assessment and learn >>>> about Cisco certifications, training, and career opportunities. >>>> http://p.sf.net/sfu/cisco-dev2dev_______________________________________________ >>>> Wonder-disc mailing list >>>> wonder-d...@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/wonder-disc >>> >>> -- >>> 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 >>> >>> >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> The demand for IT networking professionals continues to grow, and the >>> demand for specialized networking skills is growing even more rapidly. >>> Take a complimentary Learning@Cisco Self-Assessment and learn >>> about Cisco certifications, training, and career opportunities. >>> http://p.sf.net/sfu/cisco-dev2dev_______________________________________________ >>> Wonder-disc mailing list >>> wonder-d...@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/wonder-disc >> >> -- >> 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 >> >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> The demand for IT networking professionals continues to grow, and the >> demand for specialized networking skills is growing even more rapidly. >> Take a complimentary Learning@Cisco Self-Assessment and learn >> about Cisco certifications, training, and career opportunities. >> http://p.sf.net/sfu/cisco-dev2dev_______________________________________________ >> Wonder-disc mailing list >> wonder-d...@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wonder-disc > > -- > 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 > > > > > > > > > ------------------------------------------------------------------------------ > The demand for IT networking professionals continues to grow, and the > demand for specialized networking skills is growing even more rapidly. > Take a complimentary Learning@Cisco Self-Assessment and learn > about Cisco certifications, training, and career opportunities. > http://p.sf.net/sfu/cisco-dev2dev > _______________________________________________ > Wonder-disc mailing list > wonder-d...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wonder-disc > > ————————————————————————————— WebObjects - so easy that even Dave Avendasora can do it!™ ————————————————————————————— David Avendasora Senior Software Abuser Nekesto, Inc.
_______________________________________________ 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