Hi, I have this 2 tables:
| TABLE TPS16_CONFIGURATION | ( TPS16_NAME, TPS16_VALID_FROM_DATE, TPS16_OPERATING_RANGE_HI, TPS16_OPERATING_RANGE_LO, | TPS16_MAX_OPERATING_DELTA, TPS16_TIME_GRID_PROTOTYPE) | | TPS25_CURRENCIES_DIFFMIN | ( TPS16_ID, TPS25_ISO_CURRENCY, TPS25_DIFF_MIN | ) | I underlined the keys of the tables. There is a foreign key in the table TPS25_CURRENCIES_DIFFMIN in fact TPS16_ID refers to TPS16_CONFIGURATION(TPS16_NAME). Now I have a problem of mapping. The object EConfiguration maps the table TPS16_CONFIGURATION in this way: | <?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> | <class name="com.intesasanpaolo.tps.model.EConfiguration" | table="TPS16_CONFIGURATION" catalog="@CATALOG@" mutable="true"> | <comment></comment> | <id name="name" type="string" column="TPS16_NAME" | access="field"> | </id> | | <property name="validFrom" type="java.util.Date"> | <column name="TPS16_VALID_FROM_DATE" not-null="false" /> | </property> | | <property name="operatingRangeHigh" type="java.math.BigDecimal"> | <column name="TPS16_OPERATING_RANGE_HI" not-null="false" /> | </property> | | <property name="operatingRangeLow" type="java.math.BigDecimal"> | <column name="TPS16_OPERATING_RANGE_LO" not-null="false" /> | </property> | | <property name="maxOperatingDelta" type="java.math.BigDecimal"> | <column name="TPS16_MAX_OPERATING_DELTA" not-null="false" /> | </property> | | <many-to-one name="timeGridPrototype" column="TPS16_TIME_GRID_PROTOTYPE" | unique="false" not-null="false" fetch="join" cascade="all"> | </many-to-one> | | <list name="internalPortfolios" cascade="all" table="TPS17_INTERNAL_PORTFOLIO" catalog="@CATALOG@" lazy="false"> | <key column="TPS16_ID"/> | <index column="TPS16_IDX"/> | <element column="TPS17_NAME" type="string"/> | </list> | | <list name="externalPortfolios" cascade="all" table="TPS18_EXTERNAL_PORTFOLIO" catalog="@CATALOG@" lazy="false"> | <key column="TPS16_ID"/> | <index column="TPS16_IDX"/> | <element column="TPS18_NAME" type="string"/> | </list> | | <list name="internalCounterparts" cascade="all" table="TPS19_INTERNAL_COUNTERPART" catalog="@CATALOG@" lazy="false"> | <key column="TPS16_ID"/> | <index column="TPS16_IDX"/> | <element column="TPS19_NAME" type="string"/> | </list> | | <list name="externalCounterparts" cascade="all" table="TPS20_EXTERNAL_COUNTERPART" catalog="@CATALOG@" lazy="false"> | <key column="TPS16_ID"/> | <index column="TPS16_IDX"/> | <element column="TPS20_NAME" type="string"/> | </list> | | <set name="currenciesDiffMin" lazy="true" inverse="true" cascade="all-delete-orphan"> | <key column="TPS16_ID"/> | <one-to-many class="com.intesasanpaolo.tps.model.ECurrenciesDiffmin"/> | </set> | | </class> | </hibernate-mapping> | The object ECurrenciesDiffmin maps the table TPS25_CURRENCIES_DIFFMIN in this way: | <?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> | <class name="com.intesasanpaolo.tps.model.ECurrenciesDiffmin" | table="TPS25_CURRENCIES_DIFFMIN" catalog="@CATALOG@" mutable="true"> | <comment>Oggetto hibernate che mappa la tabella TPS25_CURRENCIES_DIFFMIN</comment> | | <composite-id> | <key-many-to-one name="configuration" column="TPS16_NAME" ></key-many-to-one> | <key-property name="currency" type="string"> | <column name="TPS25_ISO_CURRENCY"></column> | </key-property> | </composite-id> | | <property name="diffMin" type="double"> | <column name="TPS25_DIFF_MIN" not-null="false" /> | </property> | | </class> | </hibernate-mapping> | So I have the classes that maps the table in this way: | public class EConfiguration { | protected String name; | private Date validFrom; | private ETimeGridConfiguration timeGridPrototype; | private List externalPortfolios; | private List internalPortfolios; | private List externalCounterparts; | private List internalCounterparts; | private BigDecimal operatingRangeHigh; | private BigDecimal operatingRangeLow; | private BigDecimal maxOperatingDelta; | private Set currenciesDiffMin; | | | public Set getCurrenciesDiffMin() { | return currenciesDiffMin; | } | public void setCurrenciesDiffMin(Set currenciesDiffMin) { | this.currenciesDiffMin = currenciesDiffMin; | } | protected EConfiguration() {} | public EConfiguration(String name) { | this.name = name; | } | /** | * Configuration name | * @return The name of the configuration | */ | public String getName() { | return name; | } | /** | * Validity date | * @return The first date for which this configuration is valid | */ | public Date getValidFrom() { | return validFrom; | } | public void setValidFrom(Date validFrom) { | this.validFrom = validFrom; | } | /** | * Time grid prototype | * @return A {...@link ETimeGridConfiguration} object | */ | public ETimeGridConfiguration getTimeGridPrototype() { | return timeGridPrototype; | } | public void setTimeGridPrototype(ETimeGridConfiguration timeGridPrototype) { | this.timeGridPrototype = timeGridPrototype; | } | /** | * External deal portfolios that must be used for this hedging process | * @return A List of String representing the names of the portfolios | */ | public List getExternalPortfolios() { | return externalPortfolios; | } | public void setExternalPortfolios(List externalPortfolios) { | this.externalPortfolios = externalPortfolios; | } | /** | * Internal deal portfolios that must be hedged by this hedging process | * @return A List of String representing the names of the portfolios | */ | public List getInternalPortfolios() { | return internalPortfolios; | } | public void setInternalPortfolios(List internalPortfolios) { | this.internalPortfolios = internalPortfolios; | } | /** | * External deal counterparts that must be used for this hedging process | * @return A List of String representing the names of the counterparts | */ | public List getExternalCounterparts() { | return externalCounterparts; | } | public void setExternalCounterparts(List externalCounterparts) { | this.externalCounterparts = externalCounterparts; | } | /** | * Internal deal counterparts that must be hedged by this hedging process | * @return A List of String representing the names of the counterparts | */ | public List getInternalCounterparts() { | return internalCounterparts; | } | public void setInternalCounterparts(List internalCounterparts) { | this.internalCounterparts = internalCounterparts; | } | /** | * High limit of hedging ratio | * @return A BigDecimal representing a hedge/risk ratio | */ | public BigDecimal getOperatingRangeHigh() { | return operatingRangeHigh; | } | public void setOperatingRangeHigh(BigDecimal operatingRangeHigh) { | this.operatingRangeHigh = operatingRangeHigh; | } | /** | * Low limit of hedging ratio | * @return A BigDecimal representing a hedge/risk ratio | */ | public BigDecimal getOperatingRangeLow() { | return operatingRangeLow; | } | public void setOperatingRangeLow(BigDecimal operatingRangeLow) { | this.operatingRangeLow = operatingRangeLow; | } | /** | * Absolute value of the maximum risk amount that can exceed hedging for every time bucket | * @return A BigDecimal representing an amount | */ | public BigDecimal getMaxOperatingDelta() { | return maxOperatingDelta; | } | public void setMaxOperatingDelta(BigDecimal maxOperatingDelta) { | this.maxOperatingDelta = maxOperatingDelta; | } | public void setName(String name) { | this.name = name; | } | } | | and | public class ECurrenciesDiffmin { | | private EConfiguration configuration; | private String currency; | private double diffMin; | | public ECurrenciesDiffmin() { | super(); | } | | public ECurrenciesDiffmin(EConfiguration configuration, String currency, double diffMin) { | super(); | this.configuration = configuration; | this.currency = currency; | this.diffMin = diffMin; | } | public EConfiguration getConfiguration() { | return configuration; | } | public void setConfiguration(EConfiguration configuration) { | this.configuration = configuration; | } | public String getCurrency() { | return currency; | } | public void setCurrency(String currency) { | this.currency = currency; | } | public double getDiffMin() { | return diffMin; | } | public void setDiffMin(double diffMin) { | this.diffMin = diffMin; | } | | } | This mapping does not work and I do not understand why, can someone help me? Where do I make a mistake? How can I solve? Thanks, bye bye. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4237923#4237923 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4237923 _______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
