You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Dmitriy Setrakyan <ds...@apache.org> on 2015/04/24 15:35:48 UTC

CacheJdbcPojoStore

I have several questions about CacheJdbcPojoStore.

1. According to javadoc, this store uses reflection to analyze the classes,
but there is no setter to set the classes. What is the way to do it? Can we
make sure that javadoc reflects that?

2. Is there an example or documentation for it outside of the javadoc?

D.

Re: CacheJdbcPojoStore

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Issue created: https://issues.apache.org/jira/browse/IGNITE-812

On Sat, Apr 25, 2015 at 4:21 AM, Dmitriy Setrakyan <ds...@apache.org>
wrote:

> On Fri, Apr 24, 2015 at 12:04 PM, Alexey Kuznetsov <
> akuznetsov@gridgain.com>
> wrote:
>
> > Because of mapping to database.
> > For example, some table could be named T1 but mapped to Person.
> > Some column in that table could be named COL1 but mapped to Person.name.
> > Some column in that table could has type integer but mapped to any
> numeric
> > type supported by java (conversion will be done by JDBC).
> > Also we could map to primitives or to objects (for example: int /
> Integer).
> > Also some cols should not be mapped at all.
> >
> > But I think it is good idea to not specify any mapping if Table and
> columns
> > fully corresponds to java side.
> >
> > I will create issue to support such case.
> >
>
> I agree. We should make the simple things simple to configure.
>
>
> >
> >
> > On Fri, Apr 24, 2015 at 10:40 PM, Dmitriy Setrakyan <
> dsetrakyan@apache.org
> > >
> > wrote:
> >
> > > I am a bit confused. Why can't we provide just a simple list of classes
> > to
> > > CacheJdbcPojoStore? Why do we need to define the whole metadata?
> > >
> > > On Fri, Apr 24, 2015 at 10:28 AM, Alexey Kuznetsov <
> > > akuznetsov@gridgain.com>
> > > wrote:
> > >
> > > > CacheJdbcPojoStore uses CacheTypeMetadata to describe connection
> > between
> > > > database table and POJO.
> > > >
> > > > In CacheTypeMetadata user should specify DB schema name, table name,
> > key
> > > > class name, value class name and how these classes mapped to DB
> table.
> > > > Using this information CacheJdbcPojoStore will find getters and
> setters
> > > in
> > > > POJO via reflection (assuming that POJO is a Java bean).
> > > >
> > > > About documentation:
> > > >     http://apacheignite.readme.io/v1.0/docs/automatic-persistence
> > > >     examples\schema-import\README.txt
> > > >
> > > >
> > > >
> > > > On Fri, Apr 24, 2015 at 8:35 PM, Dmitriy Setrakyan <
> > > dsetrakyan@apache.org>
> > > > wrote:
> > > >
> > > > > I have several questions about CacheJdbcPojoStore.
> > > > >
> > > > > 1. According to javadoc, this store uses reflection to analyze the
> > > > classes,
> > > > > but there is no setter to set the classes. What is the way to do
> it?
> > > Can
> > > > we
> > > > > make sure that javadoc reflects that?
> > > > >
> > > > > 2. Is there an example or documentation for it outside of the
> > javadoc?
> > > > >
> > > > > D.
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Alexey Kuznetsov
> > > > GridGain Systems
> > > > www.gridgain.com
> > > >
> > >
> >
> >
> >
> > --
> > Alexey Kuznetsov
> > GridGain Systems
> > www.gridgain.com
> >
>



-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: CacheJdbcPojoStore

Posted by Dmitriy Setrakyan <ds...@apache.org>.
On Fri, Apr 24, 2015 at 12:04 PM, Alexey Kuznetsov <ak...@gridgain.com>
wrote:

> Because of mapping to database.
> For example, some table could be named T1 but mapped to Person.
> Some column in that table could be named COL1 but mapped to Person.name.
> Some column in that table could has type integer but mapped to any numeric
> type supported by java (conversion will be done by JDBC).
> Also we could map to primitives or to objects (for example: int / Integer).
> Also some cols should not be mapped at all.
>
> But I think it is good idea to not specify any mapping if Table and columns
> fully corresponds to java side.
>
> I will create issue to support such case.
>

I agree. We should make the simple things simple to configure.


>
>
> On Fri, Apr 24, 2015 at 10:40 PM, Dmitriy Setrakyan <dsetrakyan@apache.org
> >
> wrote:
>
> > I am a bit confused. Why can't we provide just a simple list of classes
> to
> > CacheJdbcPojoStore? Why do we need to define the whole metadata?
> >
> > On Fri, Apr 24, 2015 at 10:28 AM, Alexey Kuznetsov <
> > akuznetsov@gridgain.com>
> > wrote:
> >
> > > CacheJdbcPojoStore uses CacheTypeMetadata to describe connection
> between
> > > database table and POJO.
> > >
> > > In CacheTypeMetadata user should specify DB schema name, table name,
> key
> > > class name, value class name and how these classes mapped to DB table.
> > > Using this information CacheJdbcPojoStore will find getters and setters
> > in
> > > POJO via reflection (assuming that POJO is a Java bean).
> > >
> > > About documentation:
> > >     http://apacheignite.readme.io/v1.0/docs/automatic-persistence
> > >     examples\schema-import\README.txt
> > >
> > >
> > >
> > > On Fri, Apr 24, 2015 at 8:35 PM, Dmitriy Setrakyan <
> > dsetrakyan@apache.org>
> > > wrote:
> > >
> > > > I have several questions about CacheJdbcPojoStore.
> > > >
> > > > 1. According to javadoc, this store uses reflection to analyze the
> > > classes,
> > > > but there is no setter to set the classes. What is the way to do it?
> > Can
> > > we
> > > > make sure that javadoc reflects that?
> > > >
> > > > 2. Is there an example or documentation for it outside of the
> javadoc?
> > > >
> > > > D.
> > > >
> > >
> > >
> > >
> > > --
> > > Alexey Kuznetsov
> > > GridGain Systems
> > > www.gridgain.com
> > >
> >
>
>
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>

Re: CacheJdbcPojoStore

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Because of mapping to database.
For example, some table could be named T1 but mapped to Person.
Some column in that table could be named COL1 but mapped to Person.name.
Some column in that table could has type integer but mapped to any numeric
type supported by java (conversion will be done by JDBC).
Also we could map to primitives or to objects (for example: int / Integer).
Also some cols should not be mapped at all.

But I think it is good idea to not specify any mapping if Table and columns
fully corresponds to java side.

I will create issue to support such case.


On Fri, Apr 24, 2015 at 10:40 PM, Dmitriy Setrakyan <ds...@apache.org>
wrote:

> I am a bit confused. Why can't we provide just a simple list of classes to
> CacheJdbcPojoStore? Why do we need to define the whole metadata?
>
> On Fri, Apr 24, 2015 at 10:28 AM, Alexey Kuznetsov <
> akuznetsov@gridgain.com>
> wrote:
>
> > CacheJdbcPojoStore uses CacheTypeMetadata to describe connection between
> > database table and POJO.
> >
> > In CacheTypeMetadata user should specify DB schema name, table name, key
> > class name, value class name and how these classes mapped to DB table.
> > Using this information CacheJdbcPojoStore will find getters and setters
> in
> > POJO via reflection (assuming that POJO is a Java bean).
> >
> > About documentation:
> >     http://apacheignite.readme.io/v1.0/docs/automatic-persistence
> >     examples\schema-import\README.txt
> >
> >
> >
> > On Fri, Apr 24, 2015 at 8:35 PM, Dmitriy Setrakyan <
> dsetrakyan@apache.org>
> > wrote:
> >
> > > I have several questions about CacheJdbcPojoStore.
> > >
> > > 1. According to javadoc, this store uses reflection to analyze the
> > classes,
> > > but there is no setter to set the classes. What is the way to do it?
> Can
> > we
> > > make sure that javadoc reflects that?
> > >
> > > 2. Is there an example or documentation for it outside of the javadoc?
> > >
> > > D.
> > >
> >
> >
> >
> > --
> > Alexey Kuznetsov
> > GridGain Systems
> > www.gridgain.com
> >
>



-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: CacheJdbcPojoStore

Posted by Dmitriy Setrakyan <ds...@apache.org>.
I am a bit confused. Why can't we provide just a simple list of classes to
CacheJdbcPojoStore? Why do we need to define the whole metadata?

On Fri, Apr 24, 2015 at 10:28 AM, Alexey Kuznetsov <ak...@gridgain.com>
wrote:

> CacheJdbcPojoStore uses CacheTypeMetadata to describe connection between
> database table and POJO.
>
> In CacheTypeMetadata user should specify DB schema name, table name, key
> class name, value class name and how these classes mapped to DB table.
> Using this information CacheJdbcPojoStore will find getters and setters in
> POJO via reflection (assuming that POJO is a Java bean).
>
> About documentation:
>     http://apacheignite.readme.io/v1.0/docs/automatic-persistence
>     examples\schema-import\README.txt
>
>
>
> On Fri, Apr 24, 2015 at 8:35 PM, Dmitriy Setrakyan <ds...@apache.org>
> wrote:
>
> > I have several questions about CacheJdbcPojoStore.
> >
> > 1. According to javadoc, this store uses reflection to analyze the
> classes,
> > but there is no setter to set the classes. What is the way to do it? Can
> we
> > make sure that javadoc reflects that?
> >
> > 2. Is there an example or documentation for it outside of the javadoc?
> >
> > D.
> >
>
>
>
> --
> Alexey Kuznetsov
> GridGain Systems
> www.gridgain.com
>

Re: CacheJdbcPojoStore

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
CacheJdbcPojoStore uses CacheTypeMetadata to describe connection between
database table and POJO.

In CacheTypeMetadata user should specify DB schema name, table name, key
class name, value class name and how these classes mapped to DB table.
Using this information CacheJdbcPojoStore will find getters and setters in
POJO via reflection (assuming that POJO is a Java bean).

About documentation:
    http://apacheignite.readme.io/v1.0/docs/automatic-persistence
    examples\schema-import\README.txt



On Fri, Apr 24, 2015 at 8:35 PM, Dmitriy Setrakyan <ds...@apache.org>
wrote:

> I have several questions about CacheJdbcPojoStore.
>
> 1. According to javadoc, this store uses reflection to analyze the classes,
> but there is no setter to set the classes. What is the way to do it? Can we
> make sure that javadoc reflects that?
>
> 2. Is there an example or documentation for it outside of the javadoc?
>
> D.
>



-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com