Hello!

I'm developing a Groovy application and want to use Qi4j for the model
and possibly more things. Now Groovy is supposed to be Java so there
shouldn't be a problem to use it with Qi4j. But I get this after
adding a side effect:

java.lang.ClassCastException: java.lang.String cannot be cast to
groovy.lang.MetaClass
     at $Proxy19.getMetaClass(Unknown Source)
     ...
     at model.message.MessageSideEffect.giveMeContent(MessageConcern.groovy:13)
     at model.message.MessageEntity.giveMeContent(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     ...
     at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:121)
     ...
     at java.lang.reflect.Method.invoke(Method.java:597)
     at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)

And here's the side effect:

abstract class MessageSideEffect extends ConcernOf<MessageBehaviour>
implements MessageBehaviour {
 String giveMeContent() {
     String s = next.giveMeContent()
     println "sideeffect for " + s
 }
}

Line 13 is "String s = next.giveMeContent()".

The same code works when done in Java (ie after adding a few semi
colons and such). Any ideas? I should also say that I've got strange
NPE:s when initializing the composite. Like here:

     SingletonAssembler assembler = new MySingletonAssembler()
     CompositeBuilder<MessageEntity> builder =
assembler.compositeBuilderFactory().newCompositeBuilder(MessageEntity.class)
-->  builder.stateFor(MessageState.class).subject().set "shout"
     builder.stateFor(MessageState.class).content().set "speak"

Note: The MessageEntity class is not yet an Entity as I haven't
figured out how to setup the Entity Store and so forth.

I'm planning to use the JDBM entity store (as I already planned to use
JDBM for persistence). But I worry about how to migrate data between
releases. The classes will change and I guess the data then will be
inaccessible. I read a post from Aug 2007 where Rickard talked about
migrating data using xml and xslt. Have you developed this idea
further since then?

After getting the basic things to work (like creating composites,
calling methods without getting exceptions) the next step is to add
associations to the classes. I guess I'll be able to figure most
things out by looking at the existing demo apps but I wonder what will
happen when an entity with associations gets persisted. Will all
associated composites be persisted as well? Or only their id:s? And
will I need an entity store for each entity or will they be able to
share the same ES?

And one more thing. I've been searching the code base for an example
on how to set up the JDBM entity store. But I can't find one. Not even
the test case shows me how (as far as I can see). Could anyone provide
me with details here?

Please advice!

Keep up the very good work.

/Pelle P

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to