<br>   Nestor<br><br>   Look at this integration test, method testGeneratedBeans1():<br><br><a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java</a><br>
<br>   Hopefully it will be clear.<br><br>   []s<br>   Edson<br><br><div class="gmail_quote">2009/3/10 nestabur <span dir="ltr">&lt;<a href="mailto:nestabur@gmail.com">nestabur@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
Sorry, I don&#39;t understand your suggestion ...<br>
<br>
As I know, the factTypes are included in the package and referenced in the<br>
DRL files, so for getting the factType I&#39;d have to access via the package,<br>
isn&#39;t it? And your proposal is getting the factType throw the DRL file<br>
name?ż<br>
<br>
NEStor<br>
<div><div></div><div class="h5"><br>
<br>
Edson Tirelli-3 wrote:<br>
&gt;<br>
&gt;     Nestor,<br>
&gt;<br>
&gt;     As it is now, DRL files must have a package name or you will be in<br>
&gt; trouble. So, use a package name for your DRL file and use that package<br>
&gt; name<br>
&gt; to retrieve the fact type. It will work.<br>
&gt;<br>
&gt;     Meanwhile, I will fix the bug. If you can open a JIRA, even better to<br>
&gt; keep track of progress.<br>
&gt;<br>
&gt;     []s<br>
&gt;     Edson<br>
&gt;<br>
&gt; 2009/3/10 nestabur &lt;<a href="mailto:nestabur@gmail.com">nestabur@gmail.com</a>&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Any suggestions?ż<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; nestabur wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Yes,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; If I put a non existent package and type, the method getFactType<br>
&gt;&gt; returns<br>
&gt;&gt; &gt; me<br>
&gt;&gt; &gt; null value, but if I put the correct package and type it throws that<br>
&gt;&gt; &gt; error.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; NEStor<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2009/3/8 Michal Bali &lt;<a href="mailto:michalbali@gmail.com">michalbali@gmail.com</a>&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; your factTypeName should consist of package name + type name, for<br>
&gt;&gt; &gt;&gt; example:<br>
&gt;&gt; &gt;&gt; com.mycompany.Account<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Sun, Mar 8, 2009 at 7:02 PM, nestabur &lt;<a href="mailto:nestabur@gmail.com">nestabur@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Hi all,<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; I&#39;m trying to create a fact programatically like this:<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; FactType myfact =package.getFactType(factTypeName);<br>
&gt;&gt; &gt;&gt;&gt; Object myPojo = myfact.newInstance();<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; An error occurs when calling the method getFactType, here my<br>
&gt;&gt; stackTrace:<br>
&gt;&gt; &gt;&gt;&gt; 36267-1236185246849-0:0:1:1 Exception while processing message:<br>
&gt;&gt; &gt;&gt;&gt; java.lang.StringIndexOutOfBoundsException: String index out of range:<br>
&gt;&gt; -1<br>
&gt;&gt; &gt;&gt;&gt; java.lang.StringIndexOutOfBoundsException: String index out of range:<br>
&gt;&gt; -1<br>
&gt;&gt; &gt;&gt;&gt;        at java.lang.String.substring(String.java:1938)<br>
&gt;&gt; &gt;&gt;&gt;        at java.lang.String.substring(String.java:1905)<br>
&gt;&gt; &gt;&gt;&gt;        at org.drools.rule.Package.getFactType(Package.java:552)<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; My drools version is 5.0.0.M5<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Any suggestion?<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; --<br>
&gt;&gt; &gt;&gt;&gt; View this message in context:<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; <a href="http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22334399.html" target="_blank">http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22334399.html</a><br>
&gt;&gt; &gt;&gt;&gt; Sent from the drools - user mailing list archive at Nabble.com.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt;&gt; rules-users mailing list<br>
&gt;&gt; &gt;&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; rules-users mailing list<br>
&gt;&gt; &gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; rules-users mailing list<br>
&gt;&gt; &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <a href="http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22431776.html" target="_blank">http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22431776.html</a><br>
&gt;&gt; Sent from the drools - user mailing list archive at Nabble.com.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt;  Edson Tirelli<br>
&gt;  JBoss Drools Core Development<br>
&gt;  JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<br>
<br>
--<br>
</div></div>View this message in context: <a href="http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22435233.html" target="_blank">http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22435233.html</a><br>

<div><div></div><div class="h5">Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>