List of usage examples for org.hibernate.mapping Property getValue
public Value getValue()
From source file:net.chrisrichardson.ormunit.hibernate.HibernateAssertUtil.java
License:Apache License
public static void assertPropertyColumn(String idColumn, Property idProperty) { Value identifier = idProperty.getValue(); assertColumn(idColumn, identifier);/*from ww w . j av a 2 s . c o m*/ }
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
protected ComponentFieldMapping getComponentFieldMapping(String fieldName) throws MappingException { Property property = classMapping.getProperty(fieldName); Component value = (Component) property.getValue(); return new ComponentFieldMapping(property, value); }
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
private void walkComponentProperties(Iterator propertyIterator, Set fieldNames) { for (Iterator it = propertyIterator; it.hasNext();) { Property property = (Property) it.next(); String name = property.getName(); if (property.getValue() instanceof Component) { Component cv = (Component) property.getValue(); Set mungedFieldNames = mungePaths(name, fieldNames); assertAllFieldsMapped(cv, mungedFieldNames); assertFieldsExists(cv.getComponentClass(), getRoots(mungedFieldNames), false); walkComponentProperties(cv.getPropertyIterator(), mungedFieldNames); } else if (isListOfComponents(property)) { List value = (List) property.getValue(); Component cv = (Component) value.getElement(); // Duplicate Set mungedFieldNames = mungePaths(name, fieldNames); assertAllFieldsMapped(cv, mungedFieldNames); assertFieldsExists(cv.getComponentClass(), getRoots(mungedFieldNames), false); walkComponentProperties(cv.getPropertyIterator(), mungedFieldNames); }//from w w w . j a v a 2s.c o m } }
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
private boolean isListOfComponents(Property property) { return property.getValue() instanceof List && ((List) property.getValue()).getElement() instanceof Component; }
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
protected void assertCompositeListField(String fieldName) throws MappingException { Property property = classMapping.getProperty(fieldName); Value v = property.getValue(); org.hibernate.mapping.List value = (org.hibernate.mapping.List) v; }
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
protected CompositeListFieldMapping getCompositeListFieldMapping(String fieldName) throws MappingException { Property property = classMapping.getProperty(fieldName); Value v = property.getValue(); org.hibernate.mapping.List value = (org.hibernate.mapping.List) v; return new CompositeListFieldMapping(property, value); }
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
protected void assertComponentField(String fieldName) throws MappingException { Property property = classMapping.getProperty(fieldName); if (!(property.getValue() instanceof Component)) fail("field name is not mapped as a component: " + property.getValue()); }
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
protected void assertSetField(String fieldName) throws MappingException { Property property = classMapping.getProperty(fieldName); org.hibernate.mapping.Set value = (org.hibernate.mapping.Set) property.getValue(); }
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
protected void assertManyToOneField(String fieldName, String foreignKeyColumnName) throws MappingException { Property subProperty = classMapping.getProperty(fieldName); ManyToOne value = (ManyToOne) subProperty.getValue(); HibernateAssertUtil.assertColumn(foreignKeyColumnName, value); }
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
protected void assertOneToManyListField(String fieldName, String foreignKeyColumn, String indexColumn) throws MappingException { Property property = classMapping.getProperty(fieldName); org.hibernate.mapping.List value = (org.hibernate.mapping.List) property.getValue(); HibernateAssertUtil.assertColumn(foreignKeyColumn, value.getKey()); HibernateAssertUtil.assertColumn(indexColumn, value.getIndex()); assertTrue(value.getElement() instanceof OneToMany); }