<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I'm using drools 5.1.1. In drools expert document I found following in "<span class="Apple-style-span" style="font-family: Helvetica; font-size: 14px; color: rgb(74, 93, 117); "><b>Declaring Metadata for Existing Types"</b></span>&nbsp;section:<div>"<span class="Apple-style-span" style="font-family: Helvetica; font-size: 10px; ">Drools allows the declaration of metadata attributes for existing types in the same way as when declaring metadata attributes for new fact types. The only difference is that there are no fields in that declaration."</span></div><div><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;"><span class="Apple-style-span" style="font-family:
 arial; font-size: 13px; ">It says that additional fields can't be there in declaration for existing types. Are there other ways to achieve the same?</span></span></font></div><div><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;"><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></span></font></div><div><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;"><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">Thanks,</span></font></span></font></div><div><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;"><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size:
 13px;">Neel<br></span></font></span></font><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br><div id="yiv428617901">What version of Drools are you using? <br><br>AFAIK what you have done should work.<br><br><div class="yiv428617901gmail_quote">2011/8/17 Neel <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:neeleshdev@yahoo.co.in" target="_blank" href="/mc/compose?to=neeleshdev@yahoo.co.in">neeleshdev@yahoo.co.in</a>&gt;</span><br>
<blockquote class="yiv428617901gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font:inherit;" valign="top">Hi,<div>I've following class defined:</div>
<div><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;"><span style="color:#a10067;">public</span> <span style="color:#a10067;">class</span> User {</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;"><span style="white-space:pre-wrap;">        </span><span style="color:#a10067;">private</span> String <span style="color:#2700ce;">id</span>;</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;min-height:15.0px;"><span style="white-space:pre-wrap;">        </span>//get,set, equals &amp; hashCode method are defined</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;">}</p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;"></p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;"><br></p><p></p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;">
If I add more attributes using declare syntax as below:</p><span style="font-family:Monaco;font-size:11px;"><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;">declare User</p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;">
&nbsp;&nbsp; &nbsp;name : String</p></span><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;">end</p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;"><br></p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;">
it gives error "Error
 creating field accessors for 'User' for type 'User'". Is there a way, more attributes can be added in existing class using declare syntax?&nbsp;</p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;">
<br></p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;">Alternatively, if a class is created by using only declare syntax, can we add equals/hasCode methods dynamically?</p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;">
<br></p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;">Thanks &amp; Regards,</p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Monaco;">Neel</p></div></td></tr></tbody></table></blockquote></div></div><div class="plainMail"><br></div></blockquote></div></td></tr></table>