[ http://jira.jboss.com/jira/browse/EJBTHREE-102?page=history ] Bill Burke deleted EJBTHREE-102: --------------------------------
> @Entity (et al) picking up static fields/methods (PATCH) > -------------------------------------------------------- > > Key: EJBTHREE-102 > URL: http://jira.jboss.com/jira/browse/EJBTHREE-102 > Project: EJB 3.0 > Type: Bug > Reporter: Deborah Hooker > Assignee: Kabir Khan > > > As far as I can tell, the spec says not to pick up static fields and/or > methods, that they should not be included in the persistent fields of an > @Entity. > This keeps the hibernate-xml translator from including them in the generated > XML. > Index: EntityToHibernateXml.java > =================================================================== > RCS file: > /cvsroot/jboss/jboss-ejb3/src/main/org/jboss/ejb3/entity/EntityToHibernateXml.java,v > retrieving revision 1.30 > diff -u -r1.30 EntityToHibernateXml.java > --- EntityToHibernateXml.java 8 Mar 2005 19:16:56 -0000 1.30 > +++ EntityToHibernateXml.java 9 Mar 2005 07:04:07 -0000 > @@ -46,6 +46,7 @@ > import java.io.StringWriter; > import java.lang.reflect.Field; > import java.lang.reflect.Method; > +import java.lang.reflect.Modifier; > import java.util.ArrayList; > import java.util.HashMap; > import java.util.HashSet; > @@ -389,8 +390,10 @@ > Method[] methods = clazz.getDeclaredMethods(); > for (Method f : methods) > { > - Property p = new Property(f.getDeclaringClass(), f); > - if (p.isAnnotable()) list.add(p); > + if (!Modifier.isStatic(f.getModifiers())) { > + Property p = new Property(f.getDeclaringClass(), f); > + if (p.isAnnotable()) list.add(p); > + } > } > > Class superclass = clazz.getSuperclass(); > @@ -425,8 +428,11 @@ > Field[] fields = clazz.getDeclaredFields(); > for (Field f : fields) > { > - Property p = new Property(f.getDeclaringClass(), f); > - if (p.isAnnotable()) list.add(p); > + if (!Modifier.isStatic(f.getModifiers())) > + { > + Property p = new Property(f.getDeclaringClass(), f); > + if (p.isAnnotable()) list.add(p); > + } > } > > Class superclass = clazz.getSuperclass(); -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-Development mailing list JBoss-Development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-development