example :
class FinNks
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="yu.co.snpe.dbtable.model.hibernate"
default-lazy="false">
<class name="FinNks" table="FIN_NKS">
<composite-id>
<key-many-to-one name="finNk" column="NK" />
<key-property name="red" column="RED"
type="java.lang.Long" length="6" />
</composite-id>
<property name="datd" type="java.sql.Date" column="DATD"
length="10" not-null="false"/>
<property name="datv" type="java.sql.Date" column="DATV"
length="10" />
<property name="dug" type="java.math.BigDecimal" column="DUG"
length="22" />
<property name="pot" type="java.math.BigDecimal" column="POT"
length="22" />
<property name="sifd" type="java.lang.String" column="SIFD"
length="40" />
<property name="kifkuf" type="java.lang.String" column="KIFKUF"
length="20" />
<property name="anal" type="java.lang.String" column="ANAL"
length="6" />
<property name="dugs" type="java.lang.String" column="DUGS"
length="1" />
<property name="pots" type="java.lang.String" column="POTS"
length="1" />
<property name="potv" type="java.math.BigDecimal"
formula="decode(pots,'S',-pot,pot)" />
<property name="dugv" type="java.math.BigDecimal"
formula="decode(dugs,'S',-dug,dug)" />
<property name="sal" type="java.math.BigDecimal"
formula="decode(dugs,'S',-nvl(dug,0),nvl(dug,0))-decode(pots,'S',-nvl(pot,0),nvl(pot,0))" />
<many-to-one name="finKonto" class="FinKonto" not-null="false">
<column name="KON" />
</many-to-one>
<many-to-one name="finOpn" class="FinOpn" not-null="false">
<column name="OPN" />
</many-to-one>
<many-to-one name="finVal" class="FinVal" not-null="true">
<column name="VAL" />
</many-to-one>
</class>
</hibernate-mapping>
length is fine, i can find length , but nullable isn't good
i try like this :
Code:
PersistentClass classMapping = getConfiguration().getClassMapping(FinNks.class.getName());
Property property = classMapping.getProperty("datd");
boolean nullable = property.getValue().isNullable();
or
Code:
PersistentClass classMapping = getConfiguration().getClassMapping(FinNks.class.getName());
Property property = classMapping.getProperty("datd");
Column column = (Column) property.getColumnIterator().next();
boolean nullable = column.isNullable();
I get true always, for property datd (or datv - datv is nullable, but datd isn;t) and
for finKonto, finVal or finOpn - it's true always