killerbee
Legacy Member
We zitten met volgende database
tabel Meldingsfiche
meldingsficheID
naam_vereniging
aantal_bezoekers
...
tabel AntwoordBrieven
antwoordbriefID
meldingsficheID
type
opmerking
verzonden
Nu willen we een antwoordbrief wegschrijven naar de database adhv Hibernate.
Dit lukt, behalve dat de meldingsficheID niet wordt ingevuld (NULL-waarde).
Waar zit onze fout?
Mapping-bestand tabel AntwoordBrieven en klasse Antwoordbrief
Mapping-bestand van tabel Meldingsfiche en klasse Meldingsfiche
tabel Meldingsfiche
meldingsficheID
naam_vereniging
aantal_bezoekers
...
tabel AntwoordBrieven
antwoordbriefID
meldingsficheID
type
opmerking
verzonden
Nu willen we een antwoordbrief wegschrijven naar de database adhv Hibernate.
Dit lukt, behalve dat de meldingsficheID niet wordt ingevuld (NULL-waarde).
Waar zit onze fout?
Mapping-bestand tabel AntwoordBrieven en klasse Antwoordbrief
Code:
<?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>
<class lazy="false" name="org.demho.model.Antwoordbrief" table="AntwoordBrieven">
<id column="antwoordbriefID" name="id" type="int">
<generator class="native"/>
</id>
<property column="opmerking" name="opmerkingen" type="string"/>
<property column="type" name="type" type="org.demho.model.AntwoordbriefTypeUserType"/>
<property column="verzonden" name="verzonden" type="boolean"/>
</class>
</hibernate-mapping>
Mapping-bestand van tabel Meldingsfiche en klasse Meldingsfiche
Code:
<?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>
<class lazy="false" name="org.demho.model.Meldingsfiche" table="Meldingsfiches">
<id column="meldingsficheID" name="id" type="int">
<generator class="native"/>
</id>
<property column="vereniging_naam" name="verenigingNaam" type="string"/>
<property column="aantal_bezoekers" name="aantalBezoekers" type="int"/>
<property column="aanvraag_datum" name="aanvraagDatum" type="date"/>
<property column="contact_naam" name="contactNaam" type="string"/>
<property column="contact_voornaam" name="contactVoornaam" type="string"/>
<property column="contact_adres" name="contactAdres" type="string"/>
<property column="contact_gemeente" name="contactGemeente" type="string"/>
<property column="contact_telnr" name="contactTelnr" type="string"/>
<property column="contact_mobiel" name="contactMobiel" type="string"/>
<property column="contact_postcode" name="contactPostcode" type="string"/>
<property column="contact_mail" name="contactMail" type="string"/>
<property column="vereniging_aard" name="verenigingAard" type="org.demho.model.VerenigingAardUserType"/>
<property column="divers_materiaal" name="diversMateriaal" type="string"/>
<property column="begindatum" name="beginDatum" type="date"/>
<property column="einddatum" name="eindDatum" type="date"/>
<property column="beginGebruiknameUur" name="beginGebruiknameUur" type="time"/>
<property column="beginGebruiknameDatum" name="beginGebruiknameDatum" type="date"/>
<property column="begintijd" name="beginTijd" type="time"/>
<property column="eindGebruiknameUur" name="eindGebruiknameUur" type="time"/>
<property column="eindGebruiknameDatum" name="eindGebruiknameDatum" type="date"/>
<property column="eindtijd" name="eindTijd" type="time"/>
<property column="mogelijke_randactiviteiten" name="mogelijkeRandactiviteiten" type="string"/>
<property column="historiek" name="historiek" type="string"/>
<property column="omschrijving" name="omschrijving" type="string"/>
<property column="mogelijke_problemen" name="mogelijkeProblemen" type="string"/>
<property column="openbaar_domein" name="openbaarDomein" type="string"/>
<property column="uitzondering_sluitingsuren" name="uitzonderingSluitingsuren" type="string"/>
<property column="toezicht_voorzien" name="toezichtVoorzien" type="boolean"/>
<property column="status" name="status" type="org.demho.model.StatusUserType"/>
..........
<set cascade="all" lazy="false" name="antwoordbrief">
<key column="meldingsficheID"/>
<one-to-many class="org.demho.model.Antwoordbrief"/>
</set>
...........
</class>
</hibernate-mapping>