You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrey Razumovsky (JIRA)" <ji...@apache.org> on 2009/04/14 09:57:16 UTC

[jira] Commented: (CAY-400) Support for user properties of DataMap objects.

    [ https://issues.apache.org/jira/browse/CAY-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698692#action_12698692 ] 

Andrey Razumovsky commented on CAY-400:
---------------------------------------

Well, I think I could work on this one, but my choice is SQL comments in DBobjects, not exactly the idea Andrus originally proposed. Any objections?

> Support for user properties of DataMap objects.
> -----------------------------------------------
>
>                 Key: CAY-400
>                 URL: https://issues.apache.org/jira/browse/CAY-400
>             Project: Cayenne
>          Issue Type: New Feature
>          Components: Cayenne Core Library, CayenneModeler GUI
>    Affects Versions: 3.0
>            Reporter: Andrus Adamchik
>            Assignee: Ari Maniatis
>             Fix For: Short term future
>
>
> We need to support user defined properties attached to 
> * Entities
> * Attributes
> * Relationships
> (Obj and Db). This feature is similar to JDK 1.5 annotations. 
> Basic support: 
> * allow to enter string key/value pairs in the Modeler and save them in XML.
> * Just like with JVM annotations implement some logic to load annotations conditionally.
> Ideas for using this info in Cayenne:
> * Attach DB comments on reverse-engineer
> * Use certain keys to generate Javadocs during class generation
> * Use certain keys to generate JDK 1.5 annotations during class generation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 14, 2009, at 11:56 AM, Andrey Razumovsky wrote:

> What do you mean by plan?

I mean intention. Well, clearly there is :-)

Andrus


Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by "Adrian A." <a....@googlemail.com>.
>
> Yeah, this is a different task, something like CAY-659. I find the feauture
> quite useful.
>
>  (BTW, is there a plan to do that?).
> >
> >
> What do you mean by plan? This seems quite straightforward. It's all about
> adding comments in API and modeler for DbEntities and DbAttributes (I'm not
> so sure about DbRels) and then seal them in schema generating, reverse
> engineering and migrating processes. I have no information whether comments
> are supported by all DBMS, but I sincerelly hope so it is.
>
Please read again Malcolm's comment from that issue(or other of his posts
about this subject). I think he is right there.
Also that what most users ask are comments as in vertical propagation of the
DB comments to the upper levers (or in the opposite direction if the forward
DB engineering approach is used, as opposed to the more widely used reverse
engineering) .
For this "comment" support there's also a partial implementation that is
pretty advanced (i.e. UI in the Cayenne Modeler support is implemented),
just that it was made quite a while ago:
http://click.sourceforge.net/click-maven-bundle/cayenne-1.2.2.b.zip

Thank you,
A.

Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Andrey Razumovsky <ra...@gmail.com>.
Yeah, this is a different task, something like CAY-659. I find the feauture
quite useful.

 (BTW, is there a plan to do that?).
>
>
What do you mean by plan? This seems quite straightforward. It's all about
adding comments in API and modeler for DbEntities and DbAttributes (I'm not
so sure about DbRels) and then seal them in schema generating, reverse
engineering and migrating processes. I have no information whether comments
are supported by all DBMS, but I sincerelly hope so it is.

Re: multicolumn? Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 15, 2009, at 3:24 PM, Aristedes Maniatis wrote:

> Hey, there's a GSoC project... modify Cayenne modeler to store these  
> indexes.

Heh, we missed that boat already for this year.

Andrus


Re: multicolumn? Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Aristedes Maniatis <ar...@ish.com.au>.
On 15/04/2009, at 9:28 PM, Tore Halset wrote:

> What about multi-column information? I want to store information  
> about db indexes that have a name, can span multiple columns and be  
> of different types. I know this is probably out of scope for cayenne  
> as a ORM, but very useful for us since we already store all other  
> schema-related information in the model.
>
> If we go with a generic property map with string values, such  
> information could be encoded into the String, but it will not be  
> very pretty..
>
> dbEntity.setProperty("DB-INDEX", "name: myindex, type: unique,  
> columns: col1, col2");

In my opinion indexes are a very useful thing to store in the model,  
can tie into reverse engineering, be part of a database migration and  
might even be used by Cayenne to produce warnings that unindexed  
columns are being used for a query. I think they should be stored as  
their own first class items in the map and not as a generic string key- 
value.

Hey, there's a GSoC project... modify Cayenne modeler to store these  
indexes.

Ari Maniatis


-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A



multicolumn? Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.

I just want to bring another example on the table. Hope I am not  
messing things up too much.

What about multi-column information? I want to store information about  
db indexes that have a name, can span multiple columns and be of  
different types. I know this is probably out of scope for cayenne as a  
ORM, but very useful for us since we already store all other schema- 
related information in the model.

If we go with a generic property map with string values, such  
information could be encoded into the String, but it will not be very  
pretty..

dbEntity.setProperty("DB-INDEX", "name: myindex, type: unique,  
columns: col1, col2");

Regards,
  - Tore.

On Apr 14, 2009, at 10:43 , Andrus Adamchik wrote:

> Yes, this is a question of classification of "comment" property -  
> whether we think it is "generic" or not...
>
> I don't have strong feelings either ways. My criteria for a generic  
> property as "being irrelevant to Cayenne runtime" may not apply to  
> comments if you use comments in DB schema generation. (BTW, is there  
> a plan to do that?).
>
> So I am +0 on making comment an ivar. But please (re)open a separate  
> Jira for that.
>
> Andrus
>
>
>
>
> On Apr 14, 2009, at 11:30 AM, Andrey Razumovsky wrote:
>
>> I'm afraid I don't actually catch the point. This sounds like two  
>> separate
>> tasks.
>> Comments that are (re) engineered to SQL comments cannot be  
>> generic, because
>> as far as I know, SQL specifies only one string per column, table  
>> etc.
>> Generic properties are more flexible, but they cannot be saved in  
>> DB. And I
>> don't like the idea of having generic property map this one  
>> "specific"
>> comment key, because it makes the design blurry. So possibly we  
>> could open
>> both tasks (?)
>>
>> Andrey
>>
>> 2009/4/14 Aristedes Maniatis <ar...@ish.com.au>
>>
>>>
>>> On 14/04/2009, at 6:13 PM, Andrus Adamchik wrote:
>>>
>>> I have no problem with the reduced scope. But can we still make it a
>>>> generic property map initialized lazily and attached to  
>>>> DbAtrtribute or
>>>> DbEntity, with comments being just one of the possible fields in  
>>>> it? I.e.
>>>> the idea to group any properties not relevant to Cayenne runtime  
>>>> functioning
>>>> in an untyped Map<String, Object>, instead of declaring them as  
>>>> ivars
>>>>
>>>
>>> Map<String, String> might be easier unless we want to go to the  
>>> trouble of
>>> typing these objects in both Cayenne modeler with another popup  
>>> option and
>>> also in the XML. Mostly the user can cast them into some other  
>>> data type if
>>> needed.
>>>
>>> Ari
>>>
>>>
>>>
>>> -------------------------->
>>> ish
>>> http://www.ish.com.au
>>> Level 1, 30 Wilson Street Newtown 2042 Australia
>>> phone +61 2 9550 5001   fax +61 2 9550 4001
>>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>>>
>>>
>>>
>
>


Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Andrus Adamchik <an...@objectstyle.org>.
Yes, this is a question of classification of "comment" property -  
whether we think it is "generic" or not...

I don't have strong feelings either ways. My criteria for a generic  
property as "being irrelevant to Cayenne runtime" may not apply to  
comments if you use comments in DB schema generation. (BTW, is there a  
plan to do that?).

So I am +0 on making comment an ivar. But please (re)open a separate  
Jira for that.

Andrus




On Apr 14, 2009, at 11:30 AM, Andrey Razumovsky wrote:

> I'm afraid I don't actually catch the point. This sounds like two  
> separate
> tasks.
> Comments that are (re) engineered to SQL comments cannot be generic,  
> because
> as far as I know, SQL specifies only one string per column, table etc.
> Generic properties are more flexible, but they cannot be saved in  
> DB. And I
> don't like the idea of having generic property map this one "specific"
> comment key, because it makes the design blurry. So possibly we  
> could open
> both tasks (?)
>
> Andrey
>
> 2009/4/14 Aristedes Maniatis <ar...@ish.com.au>
>
>>
>> On 14/04/2009, at 6:13 PM, Andrus Adamchik wrote:
>>
>> I have no problem with the reduced scope. But can we still make it a
>>> generic property map initialized lazily and attached to  
>>> DbAtrtribute or
>>> DbEntity, with comments being just one of the possible fields in  
>>> it? I.e.
>>> the idea to group any properties not relevant to Cayenne runtime  
>>> functioning
>>> in an untyped Map<String, Object>, instead of declaring them as  
>>> ivars
>>>
>>
>> Map<String, String> might be easier unless we want to go to the  
>> trouble of
>> typing these objects in both Cayenne modeler with another popup  
>> option and
>> also in the XML. Mostly the user can cast them into some other data  
>> type if
>> needed.
>>
>> Ari
>>
>>
>>
>> -------------------------->
>> ish
>> http://www.ish.com.au
>> Level 1, 30 Wilson Street Newtown 2042 Australia
>> phone +61 2 9550 5001   fax +61 2 9550 4001
>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>>
>>
>>


Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Aristedes Maniatis <ar...@ish.com.au>.
On 14/04/2009, at 6:30 PM, Andrey Razumovsky wrote:

> I'm afraid I don't actually catch the point. This sounds like two  
> separate
> tasks.
> Comments that are (re) engineered to SQL comments cannot be generic,  
> because
> as far as I know, SQL specifies only one string per column, table etc.
> Generic properties are more flexible, but they cannot be saved in  
> DB. And I
> don't like the idea of having generic property map this one "specific"
> comment key, because it makes the design blurry. So possibly we  
> could open
> both tasks (?)

Do you mean comments which will actually be passed to the database  
engine? Is this for auditing or logging? If so, I'd suggest that maybe  
they are a completely different feature to CAY-400 since the core of  
Cayenne will have to understand how to apply them.

Although we could reserve certain keys (eg. cay-javadoc, cay- 
SQLcomment) generic key-values is going against the XML paradigm and  
it might be better to just have special GUI elements for special  
things like these.

Ari Maniatis


-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A



Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Andrey Razumovsky <ra...@gmail.com>.
I'm afraid I don't actually catch the point. This sounds like two separate
tasks.
Comments that are (re) engineered to SQL comments cannot be generic, because
as far as I know, SQL specifies only one string per column, table etc.
Generic properties are more flexible, but they cannot be saved in DB. And I
don't like the idea of having generic property map this one "specific"
comment key, because it makes the design blurry. So possibly we could open
both tasks (?)

Andrey

2009/4/14 Aristedes Maniatis <ar...@ish.com.au>

>
> On 14/04/2009, at 6:13 PM, Andrus Adamchik wrote:
>
>  I have no problem with the reduced scope. But can we still make it a
>> generic property map initialized lazily and attached to DbAtrtribute or
>> DbEntity, with comments being just one of the possible fields in it? I.e.
>> the idea to group any properties not relevant to Cayenne runtime functioning
>> in an untyped Map<String, Object>, instead of declaring them as ivars
>>
>
> Map<String, String> might be easier unless we want to go to the trouble of
> typing these objects in both Cayenne modeler with another popup option and
> also in the XML. Mostly the user can cast them into some other data type if
> needed.
>
> Ari
>
>
>
> -------------------------->
> ish
> http://www.ish.com.au
> Level 1, 30 Wilson Street Newtown 2042 Australia
> phone +61 2 9550 5001   fax +61 2 9550 4001
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>
>
>

Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Aristedes Maniatis <ar...@ish.com.au>.
On 14/04/2009, at 6:13 PM, Andrus Adamchik wrote:

> I have no problem with the reduced scope. But can we still make it a  
> generic property map initialized lazily and attached to DbAtrtribute  
> or DbEntity, with comments being just one of the possible fields in  
> it? I.e. the idea to group any properties not relevant to Cayenne  
> runtime functioning in an untyped Map<String, Object>, instead of  
> declaring them as ivars

Map<String, String> might be easier unless we want to go to the  
trouble of typing these objects in both Cayenne modeler with another  
popup option and also in the XML. Mostly the user can cast them into  
some other data type if needed.

Ari



-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A



Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Aristedes Maniatis <ar...@ish.com.au>.
On 14/04/2009, at 6:19 PM, Andrus Adamchik wrote:

> One correction... Reading Ari's comment attached to CAY-400, I  
> realized that I forgot that we also need to store it in XML, so the  
> Map will be Map<String, String>

Ah, read this after I pressed send on my email. This leads me to think  
I'd like to get the XML schema [1] linked to the output of Cayenne  
Modeler, but I can't find anywhere in the modeler which writes out the  
XML. I assume it is buried into Cayenne core somewhere (although why?).

I want this to go into the top of the output file:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://cayenne.apache.org/schema/3.0/modelMap.xsd"
xmlns="http://cayenne.apache.org/schema/3.0/modelMap.xsd"
elementFormDefault="qualified">


We can then get the modeler to validate the XML with something like  
this where the SAX parser is initialised:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);




Ari


[1] http://cayenne.apache.org/schema/3.0/modelMap.xsd

-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A



Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Andrus Adamchik <an...@objectstyle.org>.
> Map<String, Object>


One correction... Reading Ari's comment attached to CAY-400, I  
realized that I forgot that we also need to store it in XML, so the  
Map will be Map<String, String>

Andrus


On Apr 14, 2009, at 11:13 AM, Andrus Adamchik wrote:

>
>> Andrey Razumovsky commented on CAY-400:
>> ---------------------------------------
>>
>> Well, I think I could work on this one, but my choice is SQL  
>> comments in DBobjects, not exactly the idea Andrus originally  
>> proposed. Any objections?
>
> I have no problem with the reduced scope. But can we still make it a  
> generic property map initialized lazily and attached to DbAtrtribute  
> or DbEntity, with comments being just one of the possible fields in  
> it? I.e. the idea to group any properties not relevant to Cayenne  
> runtime functioning in an untyped Map<String, Object>, instead of  
> declaring them as ivars.
>
> Andrus
>
>
>


Re: [jira] Commented: (CAY-400) Support for user properties of DataMap objects.

Posted by Andrus Adamchik <an...@objectstyle.org>.
> Andrey Razumovsky commented on CAY-400:
> ---------------------------------------
>
> Well, I think I could work on this one, but my choice is SQL  
> comments in DBobjects, not exactly the idea Andrus originally  
> proposed. Any objections?

I have no problem with the reduced scope. But can we still make it a  
generic property map initialized lazily and attached to DbAtrtribute  
or DbEntity, with comments being just one of the possible fields in  
it? I.e. the idea to group any properties not relevant to Cayenne  
runtime functioning in an untyped Map<String, Object>, instead of  
declaring them as ivars.

Andrus