Hi Bjello, I think Lance was onto the best ideas. The easiest would be to create a Tapestry service for creating your Cayenne objects (pseudo-code):
public class TapestryCayenneService { @Inject @Symbol(value="...") ... public Foo newFoo(ObjectContext oc) { Foo foo = oc.newObject(Foo.class); // Set values in foo from injected symbols... return foo; } public Bar newFoo(ObjectContext oc) { Bar bar = oc.newObject(Bar.class); // Set values in bar from injected symbols... return bar; } // Or if using the CayenneFilter and want the option of storing your objects in the thread context: public Foo newFoo() { return newFoo(BaseContext.getThreadObjectContext()); } ... } Then register the TapestryCayenneService in your AppModule. The other approach would be to use a servlet filter, which is much more complex. You'd probably have to register a thread local to bind your Tapestry symbol values into and then retrieve them inside your CayenneDataObject subclasses (Foo, Bar, etc) using a lifecycle callback. I think this approach would be more work and more magic (harder to implement and understand/maintain later), but if you would like to explore this avenue instead of a Tapestry service, just ask. mrg PS. Which version of Cayenne are you using? PPS. Don't use CayenneService as a DAO for deleting/saving, either. On Tue, Oct 30, 2012 at 11:48 AM, <devnull2...@gmx.de> wrote: > Hi, > > I've got a properties file that gets added with contributeSymbolSource(...) > in AppModule and injection of the values with @Inject > @Symbol(value="myProperty") works well. Unfortunately, it doesn't work in > classes that are subclasses of CayenneDataObject (I use cayenne as OR > mapper), since these aren't page, component, mixin or service classes. > > So I inject the value that I need in four different page classes that don't > need to know about this internal value, and use it as parameter when I call > some methods of the cayenne entity classes that need this value. > > Is there another way or a better way to access symbols from POJO classes? > I can't use a constant because the value in the properties file is for the > production system but gets overridden in the eclipse launch config during > development. > > > Cheers, > Bjello > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org