You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Ivan Furdi <iv...@uniplus.hr> on 2011/11/03 10:56:20 UTC

CayenneForm

Hi,

does anyone knows if its possible to use CayenneForm with an DataObject 
that has more than one PK?  (complex key)

I was trying to set up CayenneForm with an DataObject that has PK 
consisting of 2 columns (detail table).
The error or problem occurs after posting a form in method

public void render(HtmlStringBuffer buffer) {
         applyMetaData();

         // Ensure OID hidden field is set if available after a commit
         if (dataObject != null
&& isPersistent(dataObject)
&& StringUtils.isEmpty(oidField.getValue())) {

             Object pk = DataObjectUtils.pkForObject(dataObject);
             oidField.setValueObject(pk.toString());
         }
         super.render(buffer);
     }

with an error

org.apache.cayenne.CayenneRuntimeException: [v.3.0.2 Jun 11 2011 
09:52:20] Expected single column PK, got 2 columns


Is there any solution to this other than not using Cayenne ORM?

Ivan

Re: CayenneForm

Posted by Gilberto <gi...@gmail.com>.
Hi, Ivan!

I'm not using cayenne, but ...

2011/11/3 Ivan Furdi <iv...@uniplus.hr>:
> Hi,
>
> does anyone knows if its possible to use CayenneForm with an DataObject that
> has more than one PK?  (complex key)
>
this is an old problem[1]. I think this discussion[2] can help.

Hth,

Gilberto

[1] https://issues.apache.org/jira/browse/CLK-211
[2] http://click.1134972.n2.nabble.com/Click-Framework-1-3-1-now-available-td1136438.html#a1136441


> I was trying to set up CayenneForm with an DataObject that has PK consisting
> of 2 columns (detail table).
> The error or problem occurs after posting a form in method
>
> public void render(HtmlStringBuffer buffer) {
>        applyMetaData();
>
>        // Ensure OID hidden field is set if available after a commit
>        if (dataObject != null
> && isPersistent(dataObject)
> && StringUtils.isEmpty(oidField.getValue())) {
>
>            Object pk = DataObjectUtils.pkForObject(dataObject);
>            oidField.setValueObject(pk.toString());
>        }
>        super.render(buffer);
>    }
>
> with an error
>
> org.apache.cayenne.CayenneRuntimeException: [v.3.0.2 Jun 11 2011 09:52:20]
> Expected single column PK, got 2 columns
>
>
> Is there any solution to this other than not using Cayenne ORM?
>
> Ivan
>