<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Executing Play! from outside of Play! code</title>
	<atom:link href="http://www.rojotek.com/blog/2010/04/26/executing-play-from-outside-of-play-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rojotek.com/blog/2010/04/26/executing-play-from-outside-of-play-code/</link>
	<description>Software Development in Brisbane</description>
	<lastBuildDate>Fri, 03 Feb 2012 20:00:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Joseph</title>
		<link>http://www.rojotek.com/blog/2010/04/26/executing-play-from-outside-of-play-code/comment-page-1/#comment-31209</link>
		<dc:creator>Joseph</dc:creator>
		<pubDate>Wed, 30 Jun 2010 13:38:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.rojotek.com/blog/?p=949#comment-31209</guid>
		<description>Hi guys!

I&#039;m working on a play project, and running into a couple of obstacles. To give a quick overview of the project, I have to deal real-time processes with user Interface handled by play. The work horse behind is Drools. I&#039;m running into problems coupling the two elements. And I&#039;m trying to run some play code of the box, mainly accessing models. Could be kind enough to give an example of to run these calls exactly.

I seem to be missing a certain number of elements while launching the app. So a little insight on the usage of the code snippet would be much appreciated :)

Cheers,
Joseph</description>
		<content:encoded><![CDATA[<p>Hi guys!</p>
<p>I&#8217;m working on a play project, and running into a couple of obstacles. To give a quick overview of the project, I have to deal real-time processes with user Interface handled by play. The work horse behind is Drools. I&#8217;m running into problems coupling the two elements. And I&#8217;m trying to run some play code of the box, mainly accessing models. Could be kind enough to give an example of to run these calls exactly.</p>
<p>I seem to be missing a certain number of elements while launching the app. So a little insight on the usage of the code snippet would be much appreciated <img src='http://www.rojotek.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cheers,<br />
Joseph</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lex</title>
		<link>http://www.rojotek.com/blog/2010/04/26/executing-play-from-outside-of-play-code/comment-page-1/#comment-30096</link>
		<dc:creator>Lex</dc:creator>
		<pubDate>Tue, 04 May 2010 15:03:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.rojotek.com/blog/?p=949#comment-30096</guid>
		<description>Useful trick! As you feel that Play framework is lovely, I invite you to join at http://www.myplayforum.com, a new Play framework community See you soon! :)</description>
		<content:encoded><![CDATA[<p>Useful trick! As you feel that Play framework is lovely, I invite you to join at <a href="http://www.myplayforum.com" rel="nofollow">http://www.myplayforum.com</a>, a new Play framework community See you soon! <img src='http://www.rojotek.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.rojotek.com/blog/2010/04/26/executing-play-from-outside-of-play-code/comment-page-1/#comment-29899</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Mon, 26 Apr 2010 12:03:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.rojotek.com/blog/?p=949#comment-29899</guid>
		<description>ouch -- I was going through an extra level of indirection -- I had some code that called the enhanced code on the Play side -- so was calling a method on an object that then called a method on the Model subclasses.

so in my execute I was calling something like:

persister.load(), and then within the load method code was calling play models.</description>
		<content:encoded><![CDATA[<p>ouch &#8212; I was going through an extra level of indirection &#8212; I had some code that called the enhanced code on the Play side &#8212; so was calling a method on an object that then called a method on the Model subclasses.</p>
<p>so in my execute I was calling something like:</p>
<p>persister.load(), and then within the load method code was calling play models.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Owen</title>
		<link>http://www.rojotek.com/blog/2010/04/26/executing-play-from-outside-of-play-code/comment-page-1/#comment-29897</link>
		<dc:creator>Sam Owen</dc:creator>
		<pubDate>Mon, 26 Apr 2010 10:46:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.rojotek.com/blog/?p=949#comment-29897</guid>
		<description>Which version on play have you tried this on? On play 1.0.2, when I try to use the byte-code enhanced JPA static helper methods on Model subclasses (count, all, find ... etc) I get the following ...

Caused by: java.lang.UnsupportedOperationException: Please annotate your JPA model with @javax.persistence.Entity annotation.
	at play.db.jpa.JPASupport.find(JPASupport.java:395)
	at model.crud.IndexCRUD.testDeletingAnIndexRemovesAllIds(IndexCRUD.java:22)
	at model.crud.IndexCRUD.execute(IndexCRUD.java:15)
	at play.Invoker$Invocation.run(Invoker.java:176)
	... 16 more

To make these work I had to get to jump through the following hoops (and run in prod mode):

        Play.classes.add(new ApplicationClasses.ApplicationClass(name));
        Class aClass = Play.classloader.loadClass(name);

        Method declaredMethod = Play.classloader.loadClass(Invoker.class.getName()).getDeclaredMethod(&quot;invoke&quot;, Invoker.Invocation.class);

        Future f = (Future) Java.invokeStatic(declaredMethod, new Object[]{(Invoker.Invocation) aClass.newInstance()});
        f.get();

where name in the fully qualified name of the play invocation I want to run. Urg</description>
		<content:encoded><![CDATA[<p>Which version on play have you tried this on? On play 1.0.2, when I try to use the byte-code enhanced JPA static helper methods on Model subclasses (count, all, find &#8230; etc) I get the following &#8230;</p>
<p>Caused by: java.lang.UnsupportedOperationException: Please annotate your JPA model with @javax.persistence.Entity annotation.<br />
	at play.db.jpa.JPASupport.find(JPASupport.java:395)<br />
	at model.crud.IndexCRUD.testDeletingAnIndexRemovesAllIds(IndexCRUD.java:22)<br />
	at model.crud.IndexCRUD.execute(IndexCRUD.java:15)<br />
	at play.Invoker$Invocation.run(Invoker.java:176)<br />
	&#8230; 16 more</p>
<p>To make these work I had to get to jump through the following hoops (and run in prod mode):</p>
<p>        Play.classes.add(new ApplicationClasses.ApplicationClass(name));<br />
        Class aClass = Play.classloader.loadClass(name);</p>
<p>        Method declaredMethod = Play.classloader.loadClass(Invoker.class.getName()).getDeclaredMethod(&#8220;invoke&#8221;, Invoker.Invocation.class);</p>
<p>        Future f = (Future) Java.invokeStatic(declaredMethod, new Object[]{(Invoker.Invocation) aClass.newInstance()});<br />
        f.get();</p>
<p>where name in the fully qualified name of the play invocation I want to run. Urg</p>
]]></content:encoded>
	</item>
</channel>
</rss>

