You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Michael Gentry <mg...@masslight.net> on 2009/12/09 17:12:24 UTC

Embeddable bug?

Using Cayenne Modeler 3.0B1, I edited an ObjEntity's Java Type to be a
custom enum (say, foo.bar.enums.MyType *).  When I save the project, I
get a validation warning:

Warning: EmbeddedAttribute has incorrect Embeddable.

CM used to not work this way (never gave a warning for this).  Is this
to be expected now or is it a bug?

Thanks!

mrg

* There is another bug that after typing in your custom enum class, it
wipes out the DbAttribute and DB Type value, too.

RE: Binding Array in SQLTemplate

Posted by Рябицкий Евгений <er...@diasoft.ru>.
Ok.

I have same thoughts, but was surprised by this result and didn't find any word about arrays binding in docs...
So I'm creating an issue.

Evgeny.
 


-----Original Message-----
From: Andrus Adamchik [mailto:andrus@objectstyle.org] 
Sent: Friday, December 11, 2009 3:51 PM
To: dev@cayenne.apache.org
Subject: Re: Binding Array in SQLTemplate

Ah good catch. Looking at the BindDirective code, it doesn't properly  
support arrays, only collections. I guess we need to change that and  
treat arrays the same way.

Andrus

On Dec 11, 2009, at 5:42 AM, Evgeny Ryabitskiy wrote:

> No answer...
> But history  points to Andrus :)
>
> Evgeny.
>
> 10 декабря 2009 г. 10:55 пользователь Рябицкий Евгений
> <er...@diasoft.ru> написал:
>> Hello!
>> I try to use array (like String[]) as a bind parameter.
>>
>> In follow lines:
>>
>>        String[] artistNames = new String[2];
>>        artistNames[0] = "Artist1";
>>        artistNames[1] = "Artist3";
>>        String sql = "SELECT * FROM ARTIST WHERE ARTIST_NAME in  
>> (#bind($ARTISTNAMES))";
>>        SQLTemplate query = new SQLTemplate(Artist.class, sql);
>>        query.setParameters(Collections.singletonMap("ARTISTNAMES",  
>> artistNames));
>>        List result =  
>> getDomain().createDataContext().performQuery(query);
>>
>> I got this query in logs:
>>
>> INFO: SELECT * FROM ARTIST WHERE ARTIST_NAME in (?) [bind: 1:<  
>> 'Artist1','Artist3'>]
>> 10.12.2009 10:48:09 org.apache.cayenne.access.QueryLogger  
>> logSelectCount
>> INFO: === returned 0 rows. - took 0 ms.
>>
>>
>> So... What does it mean? [bind: 1:< 'Artist1','Artist3'>] ?
>> I mean what is a purpose of using array in bind? For what queries  
>> it should be used?
>>
>> Evgeny.
>>
>


Re: Binding Array in SQLTemplate

Posted by Andrus Adamchik <an...@objectstyle.org>.
Ah good catch. Looking at the BindDirective code, it doesn't properly  
support arrays, only collections. I guess we need to change that and  
treat arrays the same way.

Andrus

On Dec 11, 2009, at 5:42 AM, Evgeny Ryabitskiy wrote:

> No answer...
> But history  points to Andrus :)
>
> Evgeny.
>
> 10 декабря 2009 г. 10:55 пользователь Рябицкий Евгений
> <er...@diasoft.ru> написал:
>> Hello!
>> I try to use array (like String[]) as a bind parameter.
>>
>> In follow lines:
>>
>>        String[] artistNames = new String[2];
>>        artistNames[0] = "Artist1";
>>        artistNames[1] = "Artist3";
>>        String sql = "SELECT * FROM ARTIST WHERE ARTIST_NAME in  
>> (#bind($ARTISTNAMES))";
>>        SQLTemplate query = new SQLTemplate(Artist.class, sql);
>>        query.setParameters(Collections.singletonMap("ARTISTNAMES",  
>> artistNames));
>>        List result =  
>> getDomain().createDataContext().performQuery(query);
>>
>> I got this query in logs:
>>
>> INFO: SELECT * FROM ARTIST WHERE ARTIST_NAME in (?) [bind: 1:<  
>> 'Artist1','Artist3'>]
>> 10.12.2009 10:48:09 org.apache.cayenne.access.QueryLogger  
>> logSelectCount
>> INFO: === returned 0 rows. - took 0 ms.
>>
>>
>> So... What does it mean? [bind: 1:< 'Artist1','Artist3'>] ?
>> I mean what is a purpose of using array in bind? For what queries  
>> it should be used?
>>
>> Evgeny.
>>
>


Re: Binding Array in SQLTemplate

Posted by Evgeny Ryabitskiy <ev...@gmail.com>.
No answer...
But history  points to Andrus :)

Evgeny.

10 декабря 2009 г. 10:55 пользователь Рябицкий Евгений
<er...@diasoft.ru> написал:
> Hello!
> I try to use array (like String[]) as a bind parameter.
>
> In follow lines:
>
>        String[] artistNames = new String[2];
>        artistNames[0] = "Artist1";
>        artistNames[1] = "Artist3";
>        String sql = "SELECT * FROM ARTIST WHERE ARTIST_NAME in (#bind($ARTISTNAMES))";
>        SQLTemplate query = new SQLTemplate(Artist.class, sql);
>        query.setParameters(Collections.singletonMap("ARTISTNAMES", artistNames));
>        List result = getDomain().createDataContext().performQuery(query);
>
> I got this query in logs:
>
> INFO: SELECT * FROM ARTIST WHERE ARTIST_NAME in (?) [bind: 1:< 'Artist1','Artist3'>]
> 10.12.2009 10:48:09 org.apache.cayenne.access.QueryLogger logSelectCount
> INFO: === returned 0 rows. - took 0 ms.
>
>
> So... What does it mean? [bind: 1:< 'Artist1','Artist3'>] ?
> I mean what is a purpose of using array in bind? For what queries it should be used?
>
> Evgeny.
>

Binding Array in SQLTemplate

Posted by Рябицкий Евгений <er...@diasoft.ru>.
Hello!
I try to use array (like String[]) as a bind parameter.

In follow lines:

        String[] artistNames = new String[2];
        artistNames[0] = "Artist1";
        artistNames[1] = "Artist3";
        String sql = "SELECT * FROM ARTIST WHERE ARTIST_NAME in (#bind($ARTISTNAMES))";
        SQLTemplate query = new SQLTemplate(Artist.class, sql);
        query.setParameters(Collections.singletonMap("ARTISTNAMES", artistNames));
        List result = getDomain().createDataContext().performQuery(query);

I got this query in logs:

INFO: SELECT * FROM ARTIST WHERE ARTIST_NAME in (?) [bind: 1:< 'Artist1','Artist3'>]
10.12.2009 10:48:09 org.apache.cayenne.access.QueryLogger logSelectCount
INFO: === returned 0 rows. - took 0 ms.


So... What does it mean? [bind: 1:< 'Artist1','Artist3'>] ? 
I mean what is a purpose of using array in bind? For what queries it should be used?

Evgeny.

Re: Embeddable bug?

Posted by Andrus Adamchik <an...@objectstyle.org>.
Probably treats your custom types as embeddables for some reason.  
Please open a Jira.

On Dec 9, 2009, at 11:12 AM, Michael Gentry wrote:

> Using Cayenne Modeler 3.0B1, I edited an ObjEntity's Java Type to be a
> custom enum (say, foo.bar.enums.MyType *).  When I save the project, I
> get a validation warning:
>
> Warning: EmbeddedAttribute has incorrect Embeddable.
>
> CM used to not work this way (never gave a warning for this).  Is this
> to be expected now or is it a bug?
>
> Thanks!
>
> mrg
>
> * There is another bug that after typing in your custom enum class, it
> wipes out the DbAttribute and DB Type value, too.
>