[hibernate-dev] is it valid that having an attribute in orm.xml which doesn't exist in the pojo?

Strong Liu stliu at hibernate.org
Mon Jul 15 14:31:31 EDT 2013


On Jul 16, 2013, at 12:33 AM, Steve Ebersole <steve at hibernate.org> wrote:

> My gut reaction is that this is probably ok either way according to spec.  Though I think it should certainly be an error if the xml is "complete" .  Is there a hardship in supporting the existing "ignore it" behavior?
> 
> 

it is completed in this test case.

it probably won't too hard to support this "ignore it", after all we're doing here ( for example in this case ), we create an AnnotationInstance on FiledInfo target, the exception currently is thrown by the look up the attribute type and try to build the FieldInfo ( it needs a Type )

so, maybe we can just ignore it if the field can't be found in the class, but not sure if we should continue on this path to support it.

IMO, the most possible case is the POJO got updated but forget update the orm.xml as well, so maybe thrown exception seems a better way to go.


> On Jul 15, 2013 1:39 AM, "Strong Liu" <stliu at hibernate.org> wrote:
> hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/orm.xml
> 
> this orm.xml has :
> 
> <basic name="unknownProperty"/>
> 
> but this attribute doesn't exist in the pojo, what should we do in this case?
> 
> BTW the old metamodel / configuration seems just ignore it
> -------------------------
> Best Regards,
> 
> Strong Liu <stliu at hibernate.org>
> http://about.me/stliu/bio
> 
> 
> 
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

-------------------------
Best Regards,

Strong Liu <stliu at hibernate.org>
http://about.me/stliu/bio





More information about the hibernate-dev mailing list