Ok, I'll try this option to... I need it for my unit tests. To do this I need to create an injector? Is ther a TestCase I could extend?
Regards, Juanjo 2012/9/17 Andrus Adamchik <[email protected]> > In 3.1 you can also do that with a custom module: > > binder.bindList(Constants.SERVER_USER_TYPES_LIST) > .add(new XyzType()) > .add(new AbcType()); > > Still need to document that in the new cayenne-guide.pdf. BTW, check out > org.apache.cayenne.configuration.Constants - it declares all supported > extension points. Then you may take a look at ServerModule sources to see > what Cayenne currently uses for each of those things. > > Andrus > > On Sep 17, 2012, at 4:22 AM, Tore Halset <[email protected]> wrote: > > Hello. > > > > I do it this way with 3.1. > > > > ServerRuntime runtime = ..... > > DataDomain domain = runtime.getDataDomain(); > > DataNode node = domain.getDataNode("mydatanode"); > > ExtendedTypeMap extendedTypes = > node.getAdapter().getExtendedTypes(); > > extendedTypes.registerType(new ColorType()); > > extendedTypes.registerType(new > WKTGeometryType(Geometry.class)); > > > > Btw, you should use 3.1B instead of 3.1M as B is newer. > > > > Regards, > > Tore Halset. > > > > On Sep 17, 2012, at 02:11 , Juan José Gil wrote: > > > >> Hi, > >> > >> I'm trying to use 3.1M3 version and I've noted that my ExtendedType > >> registrations aren't working anymore. > >> I've looked at docs, but they don't seem to be update. So I had readed > the > >> unit tests at svn; but I did not understand them :( > >> > >> Has anynoe already solved this problem? > >> > >> The errors are: > >> > >> import org.apache.cayenne.BaseContext; > >> import org.apache.cayenne.ObjectContext; > >> import org.apache.cayenne.access.DataContext; > >> import org.apache.cayenne.access.DataDomain; > >> import org.apache.cayenne.access.DataNode; > >> import org.apache.cayenne.conf.Configuration; > >> > >> ... > >> > >> @Before public void setupCayenne() { > >> final DataDomain domain = > >> Configuration.getSharedConfiguration().getDomain(); // <-- it does not > know > >> "Configuration" > >> for (final DataNode node : domain.getDataNodes()) { > >> > >> > node.getAdapter().getExtendedTypes().registerType(DateTimeType.INSTANCE); > >> > >> > node.getAdapter().getExtendedTypes().registerType(LocalDateType.INSTANCE); > >> > >> > node.getAdapter().getExtendedTypes().registerType(LocalDateTimeType.INSTANCE); > >> > >> > node.getAdapter().getExtendedTypes().registerType(LocalTimeType.INSTANCE); > >> } > >> > >> final ObjectContext context = DataContext.createDataContext(); // <-- > >> this method doesn't exists anymore > >> BaseContext.bindThreadObjectContext(context); > >> } > >> > >> is there a sample I could reach? > >> > >> Best Regards > >> Juanjo > > > > > >
