Hello guys sorry if the question looks stupid to you. i have 3 tables currency (id | name) language (id| name | description) transaction (id|amount|languageId | currencyid)
so i want to insert into the transaction but making sure that it doesn't insert unknown language or currency (meaning it shouldn't insert to messagetemplate if there is no existing parent language and currency)
here are my mapping files
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.myproject.model">
<class name="Transaction" table="transaction">
<id name="id">
<generator class="native"/>
</id>
<property column="amount" name="amount" type="String"/>
<many-to-one class="CurrencyImpl" column="currency" name="currency"/>
<many-to-one class="LanguageImpl" column="language" name="language"/>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.myproject.model">
<class name="Currency" table="currency">
<id name="id">
<generator class="native"/>
</id>
<property column="currency_name" name="name" type="String"/>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.myproject.model">
<class name="Language" table="language">
<id name="id">
<generator class="native"/>
</id>
<property column="language_name" name="name" type="String"/>
<property column="language_description" name="description" type="String"/>
</class>
</hibernate-mapping>
with this current mapping it's seems not to be the case.how to achieve that? thanks a lot for reading