alex.smith31 wrote:
OK here's some ellaboration on the error/problem. I am attempting to create
a Subscription object which is simply a link between a Resource object and
UserProfile object. This simplistic model only contains these three
different objects. The mapping of the Subscription to database fields is
essentially:

<class name="Subscription" identity="id" key-generator="IDENTITY">
    <map-to table="subscription"/>
    <field name="id" type="string">
        <sql name="id" type="integer"/>
    </field>
    <field name="UserProfile" type="UserProfile">
        <sql name="user_profile_id"/>
    </field>
....


<snip/>


java.sql.SQLException: General error, message from server: "Column
'user_profile_id' cannot be null"

is user_profile_id in table subscription?


I think the problem is that the member UserProfile in Subscription is not assigned an id yet.

You could try db.setAutoStore(true) or make UserProfile a dependent of Subscription in the mapping-file.

But since UserProfile probably already exist before you create a new Subscription(correct?), you must have the Subscription depend on the UserProfile instead...

Stein

Stein

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev




Reply via email to