You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Charles Moulliard <cm...@gmail.com> on 2009/12/09 14:49:43 UTC

camel-bam, camel-jpa, camel-example-etl, ...& JPA fully qualified names

Hi,

I'm stuck with the following problem. The following components :
- camel-bam,
- camel-jpa,
- camel-example-etl,
- ...

have been designed with JPA specification 1.0 but our implementation uses
Hibernate JPA. Unfortunately, Hibernate has added some extensions.

A good example is the fully qualified name which is used by camel jpa
consumer/producer or in all our select c from Customer.getClass.getName.

The JPA specification does not support this

*******
4.3.1 Naming

Entities are designated in query strings by their entity names. The
entity name is defined by the name
element of the Entity annotation (or the entity-name XML descriptor
element), and defaults to
the unqualified name of the entity class. Entity names are scoped
within the persistence unit and must be
unique within the persistence unit.
******

and in consequence, switching from Hibernate to EclipseLink JPA, OpenJPA,
... is not possible today.

Any suggestion are welcome to identify the best approach to improve our
components ?

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm

Re: camel-bam, camel-jpa, camel-example-etl, ...& JPA fully qualified names

Posted by Charles Moulliard <cm...@gmail.com>.
This is exactly what I do : adding a test to check if we have property name
defined at the level of @Entity otherwise use simpleName()

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Wed, Dec 9, 2009 at 3:37 PM, Claus Ibsen <cl...@gmail.com> wrote:

> On Wed, Dec 9, 2009 at 3:26 PM, Charles Moulliard <cm...@gmail.com>
> wrote:
> > Not really
> >
> > The following part of the JPA consumer code by example will use the
> > entityType defined at the endpoint and in consequence will generate the
> > wrong sql query.
> >
> >    protected QueryFactory createQueryFactory() {
> >        if (query != null) {
> >            return QueryBuilder.query(query);
> >        } else if (namedQuery != null) {
> >            return QueryBuilder.namedQuery(namedQuery);
> >        } else if (nativeQuery != null) {
> >            return QueryBuilder.nativeQuery(nativeQuery);
> >        } else {
> >            Class<?> entityType = endpoint.getEntityType();
> >            if (entityType == null) {
> >                return null;
> >            } else {
> >                return QueryBuilder.query("select x from " +
> > entityType.getName() + " x");
> >            }
> >        }
> >    }
> >
>
> Try replacing entityType.getName() with entityType.getSimpleName() and
> add those annotations that willem suggested with the same simple name.
> Then I think it would NOT use the fully qual name.
>
>
> > Regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> > twitter : http://twitter.com/cmoulliard
> > Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> >
> > Apache Camel Group :
> > http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> >
> >
> > On Wed, Dec 9, 2009 at 3:22 PM, Willem Jiang <wi...@gmail.com>
> wrote:
> >
> >> Hi Charles,
> >>
> >> Does the Entity annotation do the trick ?
> >> eg.
> >>
> >> @Entity(name="AtivityDefinitin")
> >> public class ActivityDefinition {
> >> ...
> >> }
> >>
> >> Willem
> >>
> >>
> >> Charles Moulliard wrote:
> >>
> >>> done : https://issues.apache.org/activemq/browse/CAMEL-2273
> >>>
> >>>
> >>> Charles Moulliard
> >>> Senior Enterprise Architect
> >>> Apache Camel Committer
> >>>
> >>> *****************************
> >>> blog : http://cmoulliard.blogspot.com
> >>> twitter : http://twitter.com/cmoulliard
> >>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> >>>
> >>> Apache Camel Group :
> >>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> >>>
> >>>
> >>> On Wed, Dec 9, 2009 at 2:59 PM, Claus Ibsen <cl...@gmail.com>
> >>> wrote:
> >>>
> >>>  Hi Charles
> >>>>
> >>>> You are welcome to create a JIRA ticket and try to fix that issue.
> >>>>
> >>>> I guess you can find out how to change those JPA queries to NOT use
> >>>> fully qual names but just the local name.
> >>>>
> >>>>
> >>>> On Wed, Dec 9, 2009 at 2:49 PM, Charles Moulliard <
> cmoulliard@gmail.com>
> >>>> wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> I'm stuck with the following problem. The following components :
> >>>>> - camel-bam,
> >>>>> - camel-jpa,
> >>>>> - camel-example-etl,
> >>>>> - ...
> >>>>>
> >>>>> have been designed with JPA specification 1.0 but our implementation
> >>>>> uses
> >>>>> Hibernate JPA. Unfortunately, Hibernate has added some extensions.
> >>>>>
> >>>>> A good example is the fully qualified name which is used by camel jpa
> >>>>> consumer/producer or in all our select c from
> Customer.getClass.getName.
> >>>>>
> >>>>> The JPA specification does not support this
> >>>>>
> >>>>> *******
> >>>>> 4.3.1 Naming
> >>>>>
> >>>>> Entities are designated in query strings by their entity names. The
> >>>>> entity name is defined by the name
> >>>>> element of the Entity annotation (or the entity-name XML descriptor
> >>>>> element), and defaults to
> >>>>> the unqualified name of the entity class. Entity names are scoped
> >>>>> within the persistence unit and must be
> >>>>> unique within the persistence unit.
> >>>>> ******
> >>>>>
> >>>>> and in consequence, switching from Hibernate to EclipseLink JPA,
> >>>>> OpenJPA,
> >>>>> ... is not possible today.
> >>>>>
> >>>>> Any suggestion are welcome to identify the best approach to improve
> our
> >>>>> components ?
> >>>>>
> >>>>> Regards,
> >>>>>
> >>>>> Charles Moulliard
> >>>>> Senior Enterprise Architect
> >>>>> Apache Camel Committer
> >>>>>
> >>>>> *****************************
> >>>>> blog : http://cmoulliard.blogspot.com
> >>>>> twitter : http://twitter.com/cmoulliard
> >>>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> >>>>>
> >>>>> Apache Camel Group :
> >>>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> >>>>>
> >>>>>
> >>>>
> >>>> --
> >>>> Claus Ibsen
> >>>> Apache Camel Committer
> >>>>
> >>>> Author of Camel in Action: http://www.manning.com/ibsen/
> >>>> Open Source Integration: http://fusesource.com
> >>>> Blog: http://davsclaus.blogspot.com/
> >>>> Twitter: http://twitter.com/davsclaus
> >>>>
> >>>>
> >>>
> >>
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: camel-bam, camel-jpa, camel-example-etl, ...& JPA fully qualified names

Posted by Charles Moulliard <cm...@gmail.com>.
Here is what I have changed in camel-jpa

    protected QueryFactory createQueryFactory() {
        if (query != null) {
            return QueryBuilder.query(query);
        } else if (namedQuery != null) {
            return QueryBuilder.namedQuery(namedQuery);
        } else if (nativeQuery != null) {
            return QueryBuilder.nativeQuery(nativeQuery);
        } else {
            Class<?> entityType = endpoint.getEntityType();

            if (entityType == null) {
                return null;
            } else {

                // Check if we have a property name on the @Entity
annotation
                String name = getEntityName(entityType);

                if ( name != null ) {
                    return QueryBuilder.query("select x from " + name + "
x");
                } else {
                    // Remove package name of the entity to be conform with
JPA 1.0 spec
                    return QueryBuilder.query("select x from " +
entityType.getSimpleName() + " x");
                }



            }
        }
    }

    protected String getEntityName(Class<?> clazz) {

        Entity entity = clazz.getAnnotation(Entity.class);

        // Check if the property name has been defined for Entity annotation
        if ( ! entity.name().equals("") ) {
            return entity.name();
        } else {
            return null;
        }

    }


Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Wed, Dec 9, 2009 at 3:49 PM, Willem Jiang <wi...@gmail.com> wrote:

>
>
> Claus Ibsen wrote:
>
>> On Wed, Dec 9, 2009 at 3:26 PM, Charles Moulliard <cm...@gmail.com>
>> wrote:
>>
>>> Not really
>>>
>>> The following part of the JPA consumer code by example will use the
>>> entityType defined at the endpoint and in consequence will generate the
>>> wrong sql query.
>>>
>>>   protected QueryFactory createQueryFactory() {
>>>       if (query != null) {
>>>           return QueryBuilder.query(query);
>>>       } else if (namedQuery != null) {
>>>           return QueryBuilder.namedQuery(namedQuery);
>>>       } else if (nativeQuery != null) {
>>>           return QueryBuilder.nativeQuery(nativeQuery);
>>>       } else {
>>>           Class<?> entityType = endpoint.getEntityType();
>>>           if (entityType == null) {
>>>               return null;
>>>           } else {
>>>               return QueryBuilder.query("select x from " +
>>> entityType.getName() + " x");
>>>           }
>>>       }
>>>   }
>>>
>>>
>> Try replacing entityType.getName() with entityType.getSimpleName() and
>> add those annotations that willem suggested with the same simple name.
>> Then I think it would NOT use the fully qual name.
>>
>>
>>
> +1, I just have the same idea as claus said when I was try to get my
> daughter sleep :)
>
>
>
>  Regards,
>>>
>>> Charles Moulliard
>>> Senior Enterprise Architect
>>> Apache Camel Committer
>>>
>>> *****************************
>>> blog : http://cmoulliard.blogspot.com
>>> twitter : http://twitter.com/cmoulliard
>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>
>>> Apache Camel Group :
>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>
>>>
>>> On Wed, Dec 9, 2009 at 3:22 PM, Willem Jiang <wi...@gmail.com>
>>> wrote:
>>>
>>>  Hi Charles,
>>>>
>>>> Does the Entity annotation do the trick ?
>>>> eg.
>>>>
>>>> @Entity(name="AtivityDefinitin")
>>>> public class ActivityDefinition {
>>>> ...
>>>> }
>>>>
>>>> Willem
>>>>
>>>>
>>>> Charles Moulliard wrote:
>>>>
>>>>  done : https://issues.apache.org/activemq/browse/CAMEL-2273
>>>>>
>>>>>
>>>>> Charles Moulliard
>>>>> Senior Enterprise Architect
>>>>> Apache Camel Committer
>>>>>
>>>>> *****************************
>>>>> blog : http://cmoulliard.blogspot.com
>>>>> twitter : http://twitter.com/cmoulliard
>>>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>>>
>>>>> Apache Camel Group :
>>>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>>>
>>>>>
>>>>> On Wed, Dec 9, 2009 at 2:59 PM, Claus Ibsen <cl...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>  Hi Charles
>>>>>
>>>>>> You are welcome to create a JIRA ticket and try to fix that issue.
>>>>>>
>>>>>> I guess you can find out how to change those JPA queries to NOT use
>>>>>> fully qual names but just the local name.
>>>>>>
>>>>>>
>>>>>> On Wed, Dec 9, 2009 at 2:49 PM, Charles Moulliard <
>>>>>> cmoulliard@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>  Hi,
>>>>>>>
>>>>>>> I'm stuck with the following problem. The following components :
>>>>>>> - camel-bam,
>>>>>>> - camel-jpa,
>>>>>>> - camel-example-etl,
>>>>>>> - ...
>>>>>>>
>>>>>>> have been designed with JPA specification 1.0 but our implementation
>>>>>>> uses
>>>>>>> Hibernate JPA. Unfortunately, Hibernate has added some extensions.
>>>>>>>
>>>>>>> A good example is the fully qualified name which is used by camel jpa
>>>>>>> consumer/producer or in all our select c from
>>>>>>> Customer.getClass.getName.
>>>>>>>
>>>>>>> The JPA specification does not support this
>>>>>>>
>>>>>>> *******
>>>>>>> 4.3.1 Naming
>>>>>>>
>>>>>>> Entities are designated in query strings by their entity names. The
>>>>>>> entity name is defined by the name
>>>>>>> element of the Entity annotation (or the entity-name XML descriptor
>>>>>>> element), and defaults to
>>>>>>> the unqualified name of the entity class. Entity names are scoped
>>>>>>> within the persistence unit and must be
>>>>>>> unique within the persistence unit.
>>>>>>> ******
>>>>>>>
>>>>>>> and in consequence, switching from Hibernate to EclipseLink JPA,
>>>>>>> OpenJPA,
>>>>>>> ... is not possible today.
>>>>>>>
>>>>>>> Any suggestion are welcome to identify the best approach to improve
>>>>>>> our
>>>>>>> components ?
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Charles Moulliard
>>>>>>> Senior Enterprise Architect
>>>>>>> Apache Camel Committer
>>>>>>>
>>>>>>> *****************************
>>>>>>> blog : http://cmoulliard.blogspot.com
>>>>>>> twitter : http://twitter.com/cmoulliard
>>>>>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>>
>>>>>>> Apache Camel Group :
>>>>>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>
>>>>>>
>>>>>>
>>
>>
>>
>

Re: camel-bam, camel-jpa, camel-example-etl, ...& JPA fully qualified names

Posted by Willem Jiang <wi...@gmail.com>.

Claus Ibsen wrote:
> On Wed, Dec 9, 2009 at 3:26 PM, Charles Moulliard <cm...@gmail.com> wrote:
>> Not really
>>
>> The following part of the JPA consumer code by example will use the
>> entityType defined at the endpoint and in consequence will generate the
>> wrong sql query.
>>
>>    protected QueryFactory createQueryFactory() {
>>        if (query != null) {
>>            return QueryBuilder.query(query);
>>        } else if (namedQuery != null) {
>>            return QueryBuilder.namedQuery(namedQuery);
>>        } else if (nativeQuery != null) {
>>            return QueryBuilder.nativeQuery(nativeQuery);
>>        } else {
>>            Class<?> entityType = endpoint.getEntityType();
>>            if (entityType == null) {
>>                return null;
>>            } else {
>>                return QueryBuilder.query("select x from " +
>> entityType.getName() + " x");
>>            }
>>        }
>>    }
>>
> 
> Try replacing entityType.getName() with entityType.getSimpleName() and
> add those annotations that willem suggested with the same simple name.
> Then I think it would NOT use the fully qual name.
> 
> 

+1, I just have the same idea as claus said when I was try to get my 
daughter sleep :)


>> Regards,
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>> twitter : http://twitter.com/cmoulliard
>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>
>> Apache Camel Group :
>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>
>>
>> On Wed, Dec 9, 2009 at 3:22 PM, Willem Jiang <wi...@gmail.com> wrote:
>>
>>> Hi Charles,
>>>
>>> Does the Entity annotation do the trick ?
>>> eg.
>>>
>>> @Entity(name="AtivityDefinitin")
>>> public class ActivityDefinition {
>>> ...
>>> }
>>>
>>> Willem
>>>
>>>
>>> Charles Moulliard wrote:
>>>
>>>> done : https://issues.apache.org/activemq/browse/CAMEL-2273
>>>>
>>>>
>>>> Charles Moulliard
>>>> Senior Enterprise Architect
>>>> Apache Camel Committer
>>>>
>>>> *****************************
>>>> blog : http://cmoulliard.blogspot.com
>>>> twitter : http://twitter.com/cmoulliard
>>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>>
>>>> Apache Camel Group :
>>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>>
>>>>
>>>> On Wed, Dec 9, 2009 at 2:59 PM, Claus Ibsen <cl...@gmail.com>
>>>> wrote:
>>>>
>>>>  Hi Charles
>>>>> You are welcome to create a JIRA ticket and try to fix that issue.
>>>>>
>>>>> I guess you can find out how to change those JPA queries to NOT use
>>>>> fully qual names but just the local name.
>>>>>
>>>>>
>>>>> On Wed, Dec 9, 2009 at 2:49 PM, Charles Moulliard <cm...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm stuck with the following problem. The following components :
>>>>>> - camel-bam,
>>>>>> - camel-jpa,
>>>>>> - camel-example-etl,
>>>>>> - ...
>>>>>>
>>>>>> have been designed with JPA specification 1.0 but our implementation
>>>>>> uses
>>>>>> Hibernate JPA. Unfortunately, Hibernate has added some extensions.
>>>>>>
>>>>>> A good example is the fully qualified name which is used by camel jpa
>>>>>> consumer/producer or in all our select c from Customer.getClass.getName.
>>>>>>
>>>>>> The JPA specification does not support this
>>>>>>
>>>>>> *******
>>>>>> 4.3.1 Naming
>>>>>>
>>>>>> Entities are designated in query strings by their entity names. The
>>>>>> entity name is defined by the name
>>>>>> element of the Entity annotation (or the entity-name XML descriptor
>>>>>> element), and defaults to
>>>>>> the unqualified name of the entity class. Entity names are scoped
>>>>>> within the persistence unit and must be
>>>>>> unique within the persistence unit.
>>>>>> ******
>>>>>>
>>>>>> and in consequence, switching from Hibernate to EclipseLink JPA,
>>>>>> OpenJPA,
>>>>>> ... is not possible today.
>>>>>>
>>>>>> Any suggestion are welcome to identify the best approach to improve our
>>>>>> components ?
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Charles Moulliard
>>>>>> Senior Enterprise Architect
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> *****************************
>>>>>> blog : http://cmoulliard.blogspot.com
>>>>>> twitter : http://twitter.com/cmoulliard
>>>>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>
>>>>>> Apache Camel Group :
>>>>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>>>>
>>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>>
>>>>>
> 
> 
> 


Re: camel-bam, camel-jpa, camel-example-etl, ...& JPA fully qualified names

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Dec 9, 2009 at 3:26 PM, Charles Moulliard <cm...@gmail.com> wrote:
> Not really
>
> The following part of the JPA consumer code by example will use the
> entityType defined at the endpoint and in consequence will generate the
> wrong sql query.
>
>    protected QueryFactory createQueryFactory() {
>        if (query != null) {
>            return QueryBuilder.query(query);
>        } else if (namedQuery != null) {
>            return QueryBuilder.namedQuery(namedQuery);
>        } else if (nativeQuery != null) {
>            return QueryBuilder.nativeQuery(nativeQuery);
>        } else {
>            Class<?> entityType = endpoint.getEntityType();
>            if (entityType == null) {
>                return null;
>            } else {
>                return QueryBuilder.query("select x from " +
> entityType.getName() + " x");
>            }
>        }
>    }
>

Try replacing entityType.getName() with entityType.getSimpleName() and
add those annotations that willem suggested with the same simple name.
Then I think it would NOT use the fully qual name.


> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>
>
> On Wed, Dec 9, 2009 at 3:22 PM, Willem Jiang <wi...@gmail.com> wrote:
>
>> Hi Charles,
>>
>> Does the Entity annotation do the trick ?
>> eg.
>>
>> @Entity(name="AtivityDefinitin")
>> public class ActivityDefinition {
>> ...
>> }
>>
>> Willem
>>
>>
>> Charles Moulliard wrote:
>>
>>> done : https://issues.apache.org/activemq/browse/CAMEL-2273
>>>
>>>
>>> Charles Moulliard
>>> Senior Enterprise Architect
>>> Apache Camel Committer
>>>
>>> *****************************
>>> blog : http://cmoulliard.blogspot.com
>>> twitter : http://twitter.com/cmoulliard
>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>
>>> Apache Camel Group :
>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>
>>>
>>> On Wed, Dec 9, 2009 at 2:59 PM, Claus Ibsen <cl...@gmail.com>
>>> wrote:
>>>
>>>  Hi Charles
>>>>
>>>> You are welcome to create a JIRA ticket and try to fix that issue.
>>>>
>>>> I guess you can find out how to change those JPA queries to NOT use
>>>> fully qual names but just the local name.
>>>>
>>>>
>>>> On Wed, Dec 9, 2009 at 2:49 PM, Charles Moulliard <cm...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm stuck with the following problem. The following components :
>>>>> - camel-bam,
>>>>> - camel-jpa,
>>>>> - camel-example-etl,
>>>>> - ...
>>>>>
>>>>> have been designed with JPA specification 1.0 but our implementation
>>>>> uses
>>>>> Hibernate JPA. Unfortunately, Hibernate has added some extensions.
>>>>>
>>>>> A good example is the fully qualified name which is used by camel jpa
>>>>> consumer/producer or in all our select c from Customer.getClass.getName.
>>>>>
>>>>> The JPA specification does not support this
>>>>>
>>>>> *******
>>>>> 4.3.1 Naming
>>>>>
>>>>> Entities are designated in query strings by their entity names. The
>>>>> entity name is defined by the name
>>>>> element of the Entity annotation (or the entity-name XML descriptor
>>>>> element), and defaults to
>>>>> the unqualified name of the entity class. Entity names are scoped
>>>>> within the persistence unit and must be
>>>>> unique within the persistence unit.
>>>>> ******
>>>>>
>>>>> and in consequence, switching from Hibernate to EclipseLink JPA,
>>>>> OpenJPA,
>>>>> ... is not possible today.
>>>>>
>>>>> Any suggestion are welcome to identify the best approach to improve our
>>>>> components ?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Charles Moulliard
>>>>> Senior Enterprise Architect
>>>>> Apache Camel Committer
>>>>>
>>>>> *****************************
>>>>> blog : http://cmoulliard.blogspot.com
>>>>> twitter : http://twitter.com/cmoulliard
>>>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>>>
>>>>> Apache Camel Group :
>>>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>>>
>>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel-bam, camel-jpa, camel-example-etl, ...& JPA fully qualified names

Posted by Charles Moulliard <cm...@gmail.com>.
Not really

The following part of the JPA consumer code by example will use the
entityType defined at the endpoint and in consequence will generate the
wrong sql query.

    protected QueryFactory createQueryFactory() {
        if (query != null) {
            return QueryBuilder.query(query);
        } else if (namedQuery != null) {
            return QueryBuilder.namedQuery(namedQuery);
        } else if (nativeQuery != null) {
            return QueryBuilder.nativeQuery(nativeQuery);
        } else {
            Class<?> entityType = endpoint.getEntityType();
            if (entityType == null) {
                return null;
            } else {
                return QueryBuilder.query("select x from " +
entityType.getName() + " x");
            }
        }
    }

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Wed, Dec 9, 2009 at 3:22 PM, Willem Jiang <wi...@gmail.com> wrote:

> Hi Charles,
>
> Does the Entity annotation do the trick ?
> eg.
>
> @Entity(name="AtivityDefinitin")
> public class ActivityDefinition {
> ...
> }
>
> Willem
>
>
> Charles Moulliard wrote:
>
>> done : https://issues.apache.org/activemq/browse/CAMEL-2273
>>
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>> twitter : http://twitter.com/cmoulliard
>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>
>> Apache Camel Group :
>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>
>>
>> On Wed, Dec 9, 2009 at 2:59 PM, Claus Ibsen <cl...@gmail.com>
>> wrote:
>>
>>  Hi Charles
>>>
>>> You are welcome to create a JIRA ticket and try to fix that issue.
>>>
>>> I guess you can find out how to change those JPA queries to NOT use
>>> fully qual names but just the local name.
>>>
>>>
>>> On Wed, Dec 9, 2009 at 2:49 PM, Charles Moulliard <cm...@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm stuck with the following problem. The following components :
>>>> - camel-bam,
>>>> - camel-jpa,
>>>> - camel-example-etl,
>>>> - ...
>>>>
>>>> have been designed with JPA specification 1.0 but our implementation
>>>> uses
>>>> Hibernate JPA. Unfortunately, Hibernate has added some extensions.
>>>>
>>>> A good example is the fully qualified name which is used by camel jpa
>>>> consumer/producer or in all our select c from Customer.getClass.getName.
>>>>
>>>> The JPA specification does not support this
>>>>
>>>> *******
>>>> 4.3.1 Naming
>>>>
>>>> Entities are designated in query strings by their entity names. The
>>>> entity name is defined by the name
>>>> element of the Entity annotation (or the entity-name XML descriptor
>>>> element), and defaults to
>>>> the unqualified name of the entity class. Entity names are scoped
>>>> within the persistence unit and must be
>>>> unique within the persistence unit.
>>>> ******
>>>>
>>>> and in consequence, switching from Hibernate to EclipseLink JPA,
>>>> OpenJPA,
>>>> ... is not possible today.
>>>>
>>>> Any suggestion are welcome to identify the best approach to improve our
>>>> components ?
>>>>
>>>> Regards,
>>>>
>>>> Charles Moulliard
>>>> Senior Enterprise Architect
>>>> Apache Camel Committer
>>>>
>>>> *****************************
>>>> blog : http://cmoulliard.blogspot.com
>>>> twitter : http://twitter.com/cmoulliard
>>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>>
>>>> Apache Camel Group :
>>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>>
>>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>

Re: camel-bam, camel-jpa, camel-example-etl, ...& JPA fully qualified names

Posted by Willem Jiang <wi...@gmail.com>.
Hi Charles,

Does the Entity annotation do the trick ?
eg.

@Entity(name="AtivityDefinitin")
public class ActivityDefinition {
...
}

Willem

Charles Moulliard wrote:
> done : https://issues.apache.org/activemq/browse/CAMEL-2273
> 
> 
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
> 
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> 
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> 
> 
> On Wed, Dec 9, 2009 at 2:59 PM, Claus Ibsen <cl...@gmail.com> wrote:
> 
>> Hi Charles
>>
>> You are welcome to create a JIRA ticket and try to fix that issue.
>>
>> I guess you can find out how to change those JPA queries to NOT use
>> fully qual names but just the local name.
>>
>>
>> On Wed, Dec 9, 2009 at 2:49 PM, Charles Moulliard <cm...@gmail.com>
>> wrote:
>>> Hi,
>>>
>>> I'm stuck with the following problem. The following components :
>>> - camel-bam,
>>> - camel-jpa,
>>> - camel-example-etl,
>>> - ...
>>>
>>> have been designed with JPA specification 1.0 but our implementation uses
>>> Hibernate JPA. Unfortunately, Hibernate has added some extensions.
>>>
>>> A good example is the fully qualified name which is used by camel jpa
>>> consumer/producer or in all our select c from Customer.getClass.getName.
>>>
>>> The JPA specification does not support this
>>>
>>> *******
>>> 4.3.1 Naming
>>>
>>> Entities are designated in query strings by their entity names. The
>>> entity name is defined by the name
>>> element of the Entity annotation (or the entity-name XML descriptor
>>> element), and defaults to
>>> the unqualified name of the entity class. Entity names are scoped
>>> within the persistence unit and must be
>>> unique within the persistence unit.
>>> ******
>>>
>>> and in consequence, switching from Hibernate to EclipseLink JPA, OpenJPA,
>>> ... is not possible today.
>>>
>>> Any suggestion are welcome to identify the best approach to improve our
>>> components ?
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>> Senior Enterprise Architect
>>> Apache Camel Committer
>>>
>>> *****************************
>>> blog : http://cmoulliard.blogspot.com
>>> twitter : http://twitter.com/cmoulliard
>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>
>>> Apache Camel Group :
>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
> 


Re: camel-bam, camel-jpa, camel-example-etl, ...& JPA fully qualified names

Posted by Charles Moulliard <cm...@gmail.com>.
done : https://issues.apache.org/activemq/browse/CAMEL-2273


Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Wed, Dec 9, 2009 at 2:59 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi Charles
>
> You are welcome to create a JIRA ticket and try to fix that issue.
>
> I guess you can find out how to change those JPA queries to NOT use
> fully qual names but just the local name.
>
>
> On Wed, Dec 9, 2009 at 2:49 PM, Charles Moulliard <cm...@gmail.com>
> wrote:
> > Hi,
> >
> > I'm stuck with the following problem. The following components :
> > - camel-bam,
> > - camel-jpa,
> > - camel-example-etl,
> > - ...
> >
> > have been designed with JPA specification 1.0 but our implementation uses
> > Hibernate JPA. Unfortunately, Hibernate has added some extensions.
> >
> > A good example is the fully qualified name which is used by camel jpa
> > consumer/producer or in all our select c from Customer.getClass.getName.
> >
> > The JPA specification does not support this
> >
> > *******
> > 4.3.1 Naming
> >
> > Entities are designated in query strings by their entity names. The
> > entity name is defined by the name
> > element of the Entity annotation (or the entity-name XML descriptor
> > element), and defaults to
> > the unqualified name of the entity class. Entity names are scoped
> > within the persistence unit and must be
> > unique within the persistence unit.
> > ******
> >
> > and in consequence, switching from Hibernate to EclipseLink JPA, OpenJPA,
> > ... is not possible today.
> >
> > Any suggestion are welcome to identify the best approach to improve our
> > components ?
> >
> > Regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> > twitter : http://twitter.com/cmoulliard
> > Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> >
> > Apache Camel Group :
> > http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: camel-bam, camel-jpa, camel-example-etl, ...& JPA fully qualified names

Posted by Claus Ibsen <cl...@gmail.com>.
Hi Charles

You are welcome to create a JIRA ticket and try to fix that issue.

I guess you can find out how to change those JPA queries to NOT use
fully qual names but just the local name.


On Wed, Dec 9, 2009 at 2:49 PM, Charles Moulliard <cm...@gmail.com> wrote:
> Hi,
>
> I'm stuck with the following problem. The following components :
> - camel-bam,
> - camel-jpa,
> - camel-example-etl,
> - ...
>
> have been designed with JPA specification 1.0 but our implementation uses
> Hibernate JPA. Unfortunately, Hibernate has added some extensions.
>
> A good example is the fully qualified name which is used by camel jpa
> consumer/producer or in all our select c from Customer.getClass.getName.
>
> The JPA specification does not support this
>
> *******
> 4.3.1 Naming
>
> Entities are designated in query strings by their entity names. The
> entity name is defined by the name
> element of the Entity annotation (or the entity-name XML descriptor
> element), and defaults to
> the unqualified name of the entity class. Entity names are scoped
> within the persistence unit and must be
> unique within the persistence unit.
> ******
>
> and in consequence, switching from Hibernate to EclipseLink JPA, OpenJPA,
> ... is not possible today.
>
> Any suggestion are welcome to identify the best approach to improve our
> components ?
>
> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus