Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421104] Thu, 24 July 2008 10:23 Go to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
Can you check to be sure that the Author is not accidently already read into the session?
See here for how to set hibernate logging which will show this:
http://www.elver.org/hibernate/troubleshooting.html#runtime

btw, I cross-posted to the emf newsgroup as support for Teneo is now done there.

gr. Martin

Phaneesh Nagaraja wrote:
> Hi,
>
> I am trying to use the proxying to improve the performance. I am currently
> using teneo 1.0.
> I tried two different scenarios in the library example;
> Scenario 1:
> Book -> Writer which is a Many-To-One relationship is getting proxied.
>
> Scenario 2:
> But OneTimeWonder -> Author which is a One-To-One relationship is not
> getting proxied.
>
> I have attached both ecore and the mapping file that is getting generated.
> Please help me out in understanding why proxying is not working in case of
> scenario 2.
>
> Thanks
> Phaneesh
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421105 is a reply to message #421104] Thu, 24 July 2008 10:40 Go to previous messageGo to next message
Phaneesh Nagaraja is currently offline Phaneesh NagarajaFriend
Messages: 24
Registered: July 2009
Junior Member
Hi Martin,

Thanks you for the quick response.

I checked twice. Author is not being fetched.

Here are thed hibernate logs:

Scenario 1 : One to One



Query bkquery = session.createQuery("FROM Book");

List books = bkquery.list();

System.out.println(books.size());



Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
book0_.`title` as title4_0_, book0_.`pages` as pages5_0_, book0_.`category`
as category6_0_, book0_.`book_author_e_id` as book7_0_,
book0_.econtainer_class as econtainer10_0_, book0_.e_container as e11_0_,
book0_.e_container_featureid as e12_0_ from `book` book0_

3 // getting list size while writer is not yet fetched



Book iBook = (Book)books.get(0);

Writer author = iBook.getAuthor();

System.out.println(author.getName());



Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
econtainer7_2_0_, writer0_.e_container as e8_2_0_,
writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
writer0_.e_id=?

JRR Tolkien //fetching the name of the writer for which the previous query
was executed.



Scenario 2 : One to One



Query otwquery = session.createQuery("From
OneTimeWonder");

List onetimeWonders = otwquery.list();

System.out.println(onetimeWonders.size());



//All information queried while getting the size of the list

Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
library0_.`name` as name4_1_0_ from `library` library0_ where
library0_.e_id=?

Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
econtainer7_2_0_, writer0_.e_container as e8_2_0_,
writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
writer0_.e_id=?

Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
econtainer7_2_0_, writer0_.e_container as e8_2_0_,
writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
writer0_.e_id=?

Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
library0_.`name` as name4_1_0_ from `library` library0_ where
library0_.e_id=?

Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as
e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_

Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from `author`
author0_ where author0_.theBook=?

Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from `author`
author0_ where author0_.theBook=?

2 //All information queried while getting the size of the list





When I try to get the size I see that all the info is fetched at once.

Please let me know if I am missing something here.



Thanks

Phaneesh



"Martin Taal" <mtaal@elver.org> wrote in message
news:4888580F.9030401@elver.org...
> Hi Phaneesh,
> Can you check to be sure that the Author is not accidently already read
> into the session?
> See here for how to set hibernate logging which will show this:
> http://www.elver.org/hibernate/troubleshooting.html#runtime
>
> btw, I cross-posted to the emf newsgroup as support for Teneo is now done
> there.
>
> gr. Martin
>
> Phaneesh Nagaraja wrote:
>> Hi,
>>
>> I am trying to use the proxying to improve the performance. I am
>> currently using teneo 1.0.
>> I tried two different scenarios in the library example;
>> Scenario 1:
>> Book -> Writer which is a Many-To-One relationship is getting proxied.
>>
>> Scenario 2:
>> But OneTimeWonder -> Author which is a One-To-One relationship is not
>> getting proxied.
>>
>> I have attached both ecore and the mapping file that is getting
>> generated. Please help me out in understanding why proxying is not
>> working in case of scenario 2.
>>
>> Thanks
>> Phaneesh
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421115 is a reply to message #421105] Fri, 25 July 2008 09:25 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
Getting the list.size() generates a number of queries which I don't fully understand (the initial
library and writer queries). Can you post the complete testcase?
Let me know if I require anything else than the test case and the model to try this myself.

gr. Martin

Phaneesh Nagaraja wrote:
> Hi Martin,
>
> Thanks you for the quick response.
>
> I checked twice. Author is not being fetched.
>
> Here are thed hibernate logs:
>
> Scenario 1 : One to One
>
>
>
> Query bkquery = session.createQuery("FROM Book");
>
> List books = bkquery.list();
>
> System.out.println(books.size());
>
>
>
> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_, book0_.`category`
> as category6_0_, book0_.`book_author_e_id` as book7_0_,
> book0_.econtainer_class as econtainer10_0_, book0_.e_container as e11_0_,
> book0_.e_container_featureid as e12_0_ from `book` book0_
>
> 3 // getting list size while writer is not yet fetched
>
>
>
> Book iBook = (Book)books.get(0);
>
> Writer author = iBook.getAuthor();
>
> System.out.println(author.getName());
>
>
>
> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
> writer0_.e_id=?
>
> JRR Tolkien //fetching the name of the writer for which the previous query
> was executed.
>
>
>
> Scenario 2 : One to One
>
>
>
> Query otwquery = session.createQuery("From
> OneTimeWonder");
>
> List onetimeWonders = otwquery.list();
>
> System.out.println(onetimeWonders.size());
>
>
>
> //All information queried while getting the size of the list
>
> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
> library0_.`name` as name4_1_0_ from `library` library0_ where
> library0_.e_id=?
>
> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
> writer0_.e_id=?
>
> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
> writer0_.e_id=?
>
> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
> library0_.`name` as name4_1_0_ from `library` library0_ where
> library0_.e_id=?
>
> Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as
> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>
> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from `author`
> author0_ where author0_.theBook=?
>
> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from `author`
> author0_ where author0_.theBook=?
>
> 2 //All information queried while getting the size of the list
>
>
>
>
>
> When I try to get the size I see that all the info is fetched at once.
>
> Please let me know if I am missing something here.
>
>
>
> Thanks
>
> Phaneesh
>
>
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:4888580F.9030401@elver.org...
>> Hi Phaneesh,
>> Can you check to be sure that the Author is not accidently already read
>> into the session?
>> See here for how to set hibernate logging which will show this:
>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>
>> btw, I cross-posted to the emf newsgroup as support for Teneo is now done
>> there.
>>
>> gr. Martin
>>
>> Phaneesh Nagaraja wrote:
>>> Hi,
>>>
>>> I am trying to use the proxying to improve the performance. I am
>>> currently using teneo 1.0.
>>> I tried two different scenarios in the library example;
>>> Scenario 1:
>>> Book -> Writer which is a Many-To-One relationship is getting proxied.
>>>
>>> Scenario 2:
>>> But OneTimeWonder -> Author which is a One-To-One relationship is not
>>> getting proxied.
>>>
>>> I have attached both ecore and the mapping file that is getting
>>> generated. Please help me out in understanding why proxying is not
>>> working in case of scenario 2.
>>>
>>> Thanks
>>> Phaneesh
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> Cell: +31 (0)6 288 48 943
>> Tel: +31 (0)84 420 2397
>> Fax: +31 (0)84 225 9307
>> Mail: mtaal@springsite.com - mtaal@elver.org
>> Web: www.springsite.com - www.elver.org
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421116 is a reply to message #421115] Fri, 25 July 2008 12:39 Go to previous messageGo to next message
Phaneesh Nagaraja is currently offline Phaneesh NagarajaFriend
Messages: 24
Registered: July 2009
Junior Member
For scenario 1: Many to one Relationship
Java code block:
Query bkquery = session.createQuery("FROM Book");

List books = bkquery.list();

//Get the size of the fetched book

System.out.println(books.size());



Output:

3 //No of books in the books table



SQL Query fired:



select book0_.e_id as e1_0_, book0_.e_version as e3_0_, book0_.`title` as
title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as category6_0_,
book0_.`book_author_e_id` as book7_0_, book0_.econtainer_class as
econtainer10_0_, book0_.e_container as e11_0_, book0_.e_container_featureid
as e12_0_ from `book` book0_



In the above query the writer table is not accessed as we have yet to access
any writer object.



When I fetch the writer object object:



Java Code block:

Book iBook = (Book)books.get(0);

Writer author = iBook.getAuthor();

System.out.println(author.getName());



SQL query fired:



select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
econtainer7_2_0_, writer0_.e_container as e8_2_0_,
writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
writer0_.e_id=?



In the above query, the writer table is accessed when I fetch the author of
the book which is an Writer object.



Output:

JRR Tolkien //Name of the author



For Scenario 2: One to One relationship



Java Code Block:

Query otwquery = session.createQuery("From OneTimeWonder");

List onetimeWonders = otwquery.list();

System.out.println(onetimeWonders.size());



SQL query fired:



select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
library0_.`name` as name4_1_0_ from `library` library0_ where
library0_.e_id=?



select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
econtainer7_2_0_, writer0_.e_container as e8_2_0_,
writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
writer0_.e_id=?



select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
econtainer7_2_0_, writer0_.e_container as e8_2_0_,
writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
writer0_.e_id=?



select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
library0_.`name` as name4_1_0_ from `library` library0_ where
library0_.e_id=?



select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_



select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from `author`
author0_ where author0_.theBook=?



select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from `author`
author0_ where author0_.theBook=?



The above set of queries indicate that all the information from writer
table, and author table is fetched eventhough I have not accessed the writer
or author.



Output:

2 //Total records in OneTimeWonder table





I have attached the ecore model and junit testcase which would be sufficient
to try it out.



If you need any more info please let me know.



Thanks

Phaneesh







"Martin Taal" <mtaal@elver.org> wrote in message
news:g6c66e$8dp$1@build.eclipse.org...
> Hi Phaneesh,
> Getting the list.size() generates a number of queries which I don't fully
> understand (the initial
> library and writer queries). Can you post the complete testcase?
> Let me know if I require anything else than the test case and the model to
> try this myself.
>
> gr. Martin
>
> Phaneesh Nagaraja wrote:
>> Hi Martin,
>>
>> Thanks you for the quick response.
>>
>> I checked twice. Author is not being fetched.
>>
>> Here are thed hibernate logs:
>>
>> Scenario 1 : One to One
>>
>>
>>
>> Query bkquery = session.createQuery("FROM Book");
>>
>> List books = bkquery.list();
>>
>> System.out.println(books.size());
>>
>>
>>
>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>> book0_.`category`
>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as e11_0_,
>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>
>> 3 // getting list size while writer is not yet fetched
>>
>>
>>
>> Book iBook = (Book)books.get(0);
>>
>> Writer author = iBook.getAuthor();
>>
>> System.out.println(author.getName());
>>
>>
>>
>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>> e3_2_0_,
>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>> writer0_.e_id=?
>>
>> JRR Tolkien //fetching the name of the writer for which the previous
>> query
>> was executed.
>>
>>
>>
>> Scenario 2 : One to One
>>
>>
>>
>> Query otwquery = session.createQuery("From
>> OneTimeWonder");
>>
>> List onetimeWonders = otwquery.list();
>>
>> System.out.println(onetimeWonders.size());
>>
>>
>>
>> //All information queried while getting the size of the list
>>
>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>> e3_1_0_,
>> library0_.`name` as name4_1_0_ from `library` library0_ where
>> library0_.e_id=?
>>
>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>> e3_2_0_,
>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>> writer0_.e_id=?
>>
>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>> e3_2_0_,
>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>> writer0_.e_id=?
>>
>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>> e3_1_0_,
>> library0_.`name` as name4_1_0_ from `library` library0_ where
>> library0_.e_id=?
>>
>> Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as
>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>
>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>> e3_5_0_,
>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>> `author`
>> author0_ where author0_.theBook=?
>>
>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>> e3_5_0_,
>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>> `author`
>> author0_ where author0_.theBook=?
>>
>> 2 //All information queried while getting the size of the list
>>
>>
>>
>>
>>
>> When I try to get the size I see that all the info is fetched at once.
>>
>> Please let me know if I am missing something here.
>>
>>
>>
>> Thanks
>>
>> Phaneesh
>>
>>
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:4888580F.9030401@elver.org...
>>> Hi Phaneesh,
>>> Can you check to be sure that the Author is not accidently already read
>>> into the session?
>>> See here for how to set hibernate logging which will show this:
>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>
>>> btw, I cross-posted to the emf newsgroup as support for Teneo is now
>>> done
>>> there.
>>>
>>> gr. Martin
>>>
>>> Phaneesh Nagaraja wrote:
>>>> Hi,
>>>>
>>>> I am trying to use the proxying to improve the performance. I am
>>>> currently using teneo 1.0.
>>>> I tried two different scenarios in the library example;
>>>> Scenario 1:
>>>> Book -> Writer which is a Many-To-One relationship is getting proxied.
>>>>
>>>> Scenario 2:
>>>> But OneTimeWonder -> Author which is a One-To-One relationship is not
>>>> getting proxied.
>>>>
>>>> I have attached both ecore and the mapping file that is getting
>>>> generated. Please help me out in understanding why proxying is not
>>>> working in case of scenario 2.
>>>>
>>>> Thanks
>>>> Phaneesh
>>>
>>> --
>>>
>>> With Regards, Martin Taal
>>>
>>> Springsite/Elver.org
>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>> The Netherlands
>>> Cell: +31 (0)6 288 48 943
>>> Tel: +31 (0)84 420 2397
>>> Fax: +31 (0)84 225 9307
>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>> Web: www.springsite.com - www.elver.org
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org



Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421188 is a reply to message #421116] Wed, 30 July 2008 03:05 Go to previous messageGo to next message
Phaneesh Nagaraja is currently offline Phaneesh NagarajaFriend
Messages: 24
Registered: July 2009
Junior Member
Hi,

I have tried with several other similar ecore models and this behavior seems
to be consistent.

For One to one proxying is not working like it does for Many to one.

Any more info on this will be really helpful.

Thanks
Phaneesh

"Phaneesh Nagaraja" <phaneesh.nagaraja@sos.sungard.com> wrote in message
news:g6chlv$bbq$1@build.eclipse.org...
> For scenario 1: Many to one Relationship
> Java code block:
> Query bkquery = session.createQuery("FROM Book");
>
> List books = bkquery.list();
>
> //Get the size of the fetched book
>
> System.out.println(books.size());
>
>
>
> Output:
>
> 3 //No of books in the books table
>
>
>
> SQL Query fired:
>
>
>
> select book0_.e_id as e1_0_, book0_.e_version as e3_0_, book0_.`title` as
> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as category6_0_,
> book0_.`book_author_e_id` as book7_0_, book0_.econtainer_class as
> econtainer10_0_, book0_.e_container as e11_0_,
> book0_.e_container_featureid as e12_0_ from `book` book0_
>
>
>
> In the above query the writer table is not accessed as we have yet to
> access any writer object.
>
>
>
> When I fetch the writer object object:
>
>
>
> Java Code block:
>
> Book iBook = (Book)books.get(0);
>
> Writer author = iBook.getAuthor();
>
> System.out.println(author.getName());
>
>
>
> SQL query fired:
>
>
>
> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
> writer0_.e_id=?
>
>
>
> In the above query, the writer table is accessed when I fetch the author
> of the book which is an Writer object.
>
>
>
> Output:
>
> JRR Tolkien //Name of the author
>
>
>
> For Scenario 2: One to One relationship
>
>
>
> Java Code Block:
>
> Query otwquery = session.createQuery("From OneTimeWonder");
>
> List onetimeWonders = otwquery.list();
>
> System.out.println(onetimeWonders.size());
>
>
>
> SQL query fired:
>
>
>
> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
> library0_.`name` as name4_1_0_ from `library` library0_ where
> library0_.e_id=?
>
>
>
> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
> writer0_.e_id=?
>
>
>
> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
> writer0_.e_id=?
>
>
>
> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
> library0_.`name` as name4_1_0_ from `library` library0_ where
> library0_.e_id=?
>
>
>
> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>
>
>
> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
> `author` author0_ where author0_.theBook=?
>
>
>
> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
> `author` author0_ where author0_.theBook=?
>
>
>
> The above set of queries indicate that all the information from writer
> table, and author table is fetched eventhough I have not accessed the
> writer or author.
>
>
>
> Output:
>
> 2 //Total records in OneTimeWonder table
>
>
>
>
>
> I have attached the ecore model and junit testcase which would be
> sufficient to try it out.
>
>
>
> If you need any more info please let me know.
>
>
>
> Thanks
>
> Phaneesh
>
>
>
>
>
>
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:g6c66e$8dp$1@build.eclipse.org...
>> Hi Phaneesh,
>> Getting the list.size() generates a number of queries which I don't fully
>> understand (the initial
>> library and writer queries). Can you post the complete testcase?
>> Let me know if I require anything else than the test case and the model
>> to try this myself.
>>
>> gr. Martin
>>
>> Phaneesh Nagaraja wrote:
>>> Hi Martin,
>>>
>>> Thanks you for the quick response.
>>>
>>> I checked twice. Author is not being fetched.
>>>
>>> Here are thed hibernate logs:
>>>
>>> Scenario 1 : One to One
>>>
>>>
>>>
>>> Query bkquery = session.createQuery("FROM Book");
>>>
>>> List books = bkquery.list();
>>>
>>> System.out.println(books.size());
>>>
>>>
>>>
>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>> book0_.`category`
>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>> e11_0_,
>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>
>>> 3 // getting list size while writer is not yet fetched
>>>
>>>
>>>
>>> Book iBook = (Book)books.get(0);
>>>
>>> Writer author = iBook.getAuthor();
>>>
>>> System.out.println(author.getName());
>>>
>>>
>>>
>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>> e3_2_0_,
>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>> writer0_.e_id=?
>>>
>>> JRR Tolkien //fetching the name of the writer for which the previous
>>> query
>>> was executed.
>>>
>>>
>>>
>>> Scenario 2 : One to One
>>>
>>>
>>>
>>> Query otwquery = session.createQuery("From
>>> OneTimeWonder");
>>>
>>> List onetimeWonders = otwquery.list();
>>>
>>> System.out.println(onetimeWonders.size());
>>>
>>>
>>>
>>> //All information queried while getting the size of the list
>>>
>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>> e3_1_0_,
>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>> library0_.e_id=?
>>>
>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>> e3_2_0_,
>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>> writer0_.e_id=?
>>>
>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>> e3_2_0_,
>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>> writer0_.e_id=?
>>>
>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>> e3_1_0_,
>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>> library0_.e_id=?
>>>
>>> Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as
>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>>
>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>> e3_5_0_,
>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>> `author`
>>> author0_ where author0_.theBook=?
>>>
>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>> e3_5_0_,
>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>> `author`
>>> author0_ where author0_.theBook=?
>>>
>>> 2 //All information queried while getting the size of the list
>>>
>>>
>>>
>>>
>>>
>>> When I try to get the size I see that all the info is fetched at once.
>>>
>>> Please let me know if I am missing something here.
>>>
>>>
>>>
>>> Thanks
>>>
>>> Phaneesh
>>>
>>>
>>>
>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>> news:4888580F.9030401@elver.org...
>>>> Hi Phaneesh,
>>>> Can you check to be sure that the Author is not accidently already read
>>>> into the session?
>>>> See here for how to set hibernate logging which will show this:
>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>
>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is now
>>>> done
>>>> there.
>>>>
>>>> gr. Martin
>>>>
>>>> Phaneesh Nagaraja wrote:
>>>>> Hi,
>>>>>
>>>>> I am trying to use the proxying to improve the performance. I am
>>>>> currently using teneo 1.0.
>>>>> I tried two different scenarios in the library example;
>>>>> Scenario 1:
>>>>> Book -> Writer which is a Many-To-One relationship is getting proxied.
>>>>>
>>>>> Scenario 2:
>>>>> But OneTimeWonder -> Author which is a One-To-One relationship is not
>>>>> getting proxied.
>>>>>
>>>>> I have attached both ecore and the mapping file that is getting
>>>>> generated. Please help me out in understanding why proxying is not
>>>>> working in case of scenario 2.
>>>>>
>>>>> Thanks
>>>>> Phaneesh
>>>>
>>>> --
>>>>
>>>> With Regards, Martin Taal
>>>>
>>>> Springsite/Elver.org
>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>> The Netherlands
>>>> Cell: +31 (0)6 288 48 943
>>>> Tel: +31 (0)84 420 2397
>>>> Fax: +31 (0)84 225 9307
>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>> Web: www.springsite.com - www.elver.org
>>>
>>>
>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> Cell: +31 (0)6 288 48 943
>> Tel: +31 (0)84 420 2397
>> Fax: +31 (0)84 225 9307
>> Mail: mtaal@springsite.com - mtaal@elver.org
>> Web: www.springsite.com - www.elver.org
>
>
>
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421309 is a reply to message #421116] Sun, 03 August 2008 18:59 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
I found the underlying cause of this not being handled as a proxy. The main thing is that Teneo did
not map the relation correctly because it did not really treat it as a primarykeyjoincolumn. One
reason was that there was no explicit id defined on the model. Teneo adds a synthetic id but this id
does not support the foreign id-generator strategy. I won't change this as using synthetic id's is
not recommended.
So I added explicit id's to your model. The foreign generator was used correctly. Then I noticed
that the mapping was not correct. For the case of a oto mapping with pk join columns there should be
a oto on both sides. Teneo was placing a mto on one side. I needed to change the mapping logic.
With the fix the one-to-one does not need to be specified, only the @PrimaryKeyJoinColumn on one
side. See the attached ecore. Also the author was proxied correctly. Note that the proxy gets
resolved when the test does otw.getAuthor() because the getAuthor() call does author.eIsProxy()
which resolves the proxy.

Here is the mapping, attached you can find the updated ecore. This fix will be in the next build of
Teneo (one of coming days).

gr. Martin
<class name="library.impl.OneTimeWonderImpl" entity-name="OneTimeWonder" abstract="false"
lazy="true" discriminator-value="OneTimeWonder" table="`onetimewonder`" proxy="library.OneTimeWonder">
<meta attribute="eclassName">OneTimeWonder</meta>
<meta attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
<id name="id" type="long" unsaved-value="0">
<column not-null="true" unique="false" name="`id`"/>
<generator class="foreign">
<param name="property">theAuthor</param>
</generator>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="Name" lazy="false" insert="true" update="true" not-null="false" unique="false"
type="java.lang.String">
<column not-null="false" unique="false" name="`name`"/>
</property>
<one-to-one name="theAuthor" entity-name="Author" cascade="merge,persist,save-update,lock,refresh"
lazy="proxy" constrained="true"/>
</class>
<class name="library.impl.AuthorImpl" entity-name="Author" abstract="false" lazy="true"
discriminator-value="Author" table="`author`" proxy="library.Author">
<meta attribute="eclassName">Author</meta>
<meta attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
<id name="id" type="long" unsaved-value="0">
<column not-null="true" unique="false" name="`id`"/>
<generator class="native"/>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="Name" lazy="false" insert="true" update="true" not-null="false" unique="false"
type="java.lang.String">
<column not-null="false" unique="false" name="`name`"/>
</property>
<one-to-one name="theBook" entity-name="OneTimeWonder"
cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
</class>


Phaneesh Nagaraja wrote:
> For scenario 1: Many to one Relationship
> Java code block:
> Query bkquery = session.createQuery("FROM Book");
>
> List books = bkquery.list();
>
> //Get the size of the fetched book
>
> System.out.println(books.size());
>
>
>
> Output:
>
> 3 //No of books in the books table
>
>
>
> SQL Query fired:
>
>
>
> select book0_.e_id as e1_0_, book0_.e_version as e3_0_, book0_.`title` as
> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as category6_0_,
> book0_.`book_author_e_id` as book7_0_, book0_.econtainer_class as
> econtainer10_0_, book0_.e_container as e11_0_, book0_.e_container_featureid
> as e12_0_ from `book` book0_
>
>
>
> In the above query the writer table is not accessed as we have yet to access
> any writer object.
>
>
>
> When I fetch the writer object object:
>
>
>
> Java Code block:
>
> Book iBook = (Book)books.get(0);
>
> Writer author = iBook.getAuthor();
>
> System.out.println(author.getName());
>
>
>
> SQL query fired:
>
>
>
> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
> writer0_.e_id=?
>
>
>
> In the above query, the writer table is accessed when I fetch the author of
> the book which is an Writer object.
>
>
>
> Output:
>
> JRR Tolkien //Name of the author
>
>
>
> For Scenario 2: One to One relationship
>
>
>
> Java Code Block:
>
> Query otwquery = session.createQuery("From OneTimeWonder");
>
> List onetimeWonders = otwquery.list();
>
> System.out.println(onetimeWonders.size());
>
>
>
> SQL query fired:
>
>
>
> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
> library0_.`name` as name4_1_0_ from `library` library0_ where
> library0_.e_id=?
>
>
>
> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
> writer0_.e_id=?
>
>
>
> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
> writer0_.e_id=?
>
>
>
> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
> library0_.`name` as name4_1_0_ from `library` library0_ where
> library0_.e_id=?
>
>
>
> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>
>
>
> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from `author`
> author0_ where author0_.theBook=?
>
>
>
> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from `author`
> author0_ where author0_.theBook=?
>
>
>
> The above set of queries indicate that all the information from writer
> table, and author table is fetched eventhough I have not accessed the writer
> or author.
>
>
>
> Output:
>
> 2 //Total records in OneTimeWonder table
>
>
>
>
>
> I have attached the ecore model and junit testcase which would be sufficient
> to try it out.
>
>
>
> If you need any more info please let me know.
>
>
>
> Thanks
>
> Phaneesh
>
>
>
>
>
>
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:g6c66e$8dp$1@build.eclipse.org...
>> Hi Phaneesh,
>> Getting the list.size() generates a number of queries which I don't fully
>> understand (the initial
>> library and writer queries). Can you post the complete testcase?
>> Let me know if I require anything else than the test case and the model to
>> try this myself.
>>
>> gr. Martin
>>
>> Phaneesh Nagaraja wrote:
>>> Hi Martin,
>>>
>>> Thanks you for the quick response.
>>>
>>> I checked twice. Author is not being fetched.
>>>
>>> Here are thed hibernate logs:
>>>
>>> Scenario 1 : One to One
>>>
>>>
>>>
>>> Query bkquery = session.createQuery("FROM Book");
>>>
>>> List books = bkquery.list();
>>>
>>> System.out.println(books.size());
>>>
>>>
>>>
>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>> book0_.`category`
>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as e11_0_,
>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>
>>> 3 // getting list size while writer is not yet fetched
>>>
>>>
>>>
>>> Book iBook = (Book)books.get(0);
>>>
>>> Writer author = iBook.getAuthor();
>>>
>>> System.out.println(author.getName());
>>>
>>>
>>>
>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>> e3_2_0_,
>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>> writer0_.e_id=?
>>>
>>> JRR Tolkien //fetching the name of the writer for which the previous
>>> query
>>> was executed.
>>>
>>>
>>>
>>> Scenario 2 : One to One
>>>
>>>
>>>
>>> Query otwquery = session.createQuery("From
>>> OneTimeWonder");
>>>
>>> List onetimeWonders = otwquery.list();
>>>
>>> System.out.println(onetimeWonders.size());
>>>
>>>
>>>
>>> //All information queried while getting the size of the list
>>>
>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>> e3_1_0_,
>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>> library0_.e_id=?
>>>
>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>> e3_2_0_,
>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>> writer0_.e_id=?
>>>
>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>> e3_2_0_,
>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>> writer0_.e_id=?
>>>
>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>> e3_1_0_,
>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>> library0_.e_id=?
>>>
>>> Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as
>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>>
>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>> e3_5_0_,
>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>> `author`
>>> author0_ where author0_.theBook=?
>>>
>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>> e3_5_0_,
>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>> `author`
>>> author0_ where author0_.theBook=?
>>>
>>> 2 //All information queried while getting the size of the list
>>>
>>>
>>>
>>>
>>>
>>> When I try to get the size I see that all the info is fetched at once.
>>>
>>> Please let me know if I am missing something here.
>>>
>>>
>>>
>>> Thanks
>>>
>>> Phaneesh
>>>
>>>
>>>
>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>> news:4888580F.9030401@elver.org...
>>>> Hi Phaneesh,
>>>> Can you check to be sure that the Author is not accidently already read
>>>> into the session?
>>>> See here for how to set hibernate logging which will show this:
>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>
>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is now
>>>> done
>>>> there.
>>>>
>>>> gr. Martin
>>>>
>>>> Phaneesh Nagaraja wrote:
>>>>> Hi,
>>>>>
>>>>> I am trying to use the proxying to improve the performance. I am
>>>>> currently using teneo 1.0.
>>>>> I tried two different scenarios in the library example;
>>>>> Scenario 1:
>>>>> Book -> Writer which is a Many-To-One relationship is getting proxied.
>>>>>
>>>>> Scenario 2:
>>>>> But OneTimeWonder -> Author which is a One-To-One relationship is not
>>>>> getting proxied.
>>>>>
>>>>> I have attached both ecore and the mapping file that is getting
>>>>> generated. Please help me out in understanding why proxying is not
>>>>> working in case of scenario 2.
>>>>>
>>>>> Thanks
>>>>> Phaneesh
>>>> --
>>>>
>>>> With Regards, Martin Taal
>>>>
>>>> Springsite/Elver.org
>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>> The Netherlands
>>>> Cell: +31 (0)6 288 48 943
>>>> Tel: +31 (0)84 420 2397
>>>> Fax: +31 (0)84 225 9307
>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>> Web: www.springsite.com - www.elver.org
>>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> Cell: +31 (0)6 288 48 943
>> Tel: +31 (0)84 420 2397
>> Fax: +31 (0)84 225 9307
>> Mail: mtaal@springsite.com - mtaal@elver.org
>> Web: www.springsite.com - www.elver.org
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421315 is a reply to message #421309] Mon, 04 August 2008 11:00 Go to previous messageGo to next message
Phaneesh Nagaraja is currently offline Phaneesh NagarajaFriend
Messages: 24
Registered: July 2009
Junior Member
HI Martin,

Thanks a ton.
I am incorporate the changes into the model and update you ASAP.

Thanks
Phaneesh

"Martin Taal" <mtaal@elver.org> wrote in message
news:g74v64$t97$1@build.eclipse.org...
> Hi Phaneesh,
> I found the underlying cause of this not being handled as a proxy. The
> main thing is that Teneo did not map the relation correctly because it did
> not really treat it as a primarykeyjoincolumn. One reason was that there
> was no explicit id defined on the model. Teneo adds a synthetic id but
> this id does not support the foreign id-generator strategy. I won't change
> this as using synthetic id's is not recommended.
> So I added explicit id's to your model. The foreign generator was used
> correctly. Then I noticed that the mapping was not correct. For the case
> of a oto mapping with pk join columns there should be a oto on both sides.
> Teneo was placing a mto on one side. I needed to change the mapping logic.
> With the fix the one-to-one does not need to be specified, only the
> @PrimaryKeyJoinColumn on one side. See the attached ecore. Also the author
> was proxied correctly. Note that the proxy gets resolved when the test
> does otw.getAuthor() because the getAuthor() call does author.eIsProxy()
> which resolves the proxy.
>
> Here is the mapping, attached you can find the updated ecore. This fix
> will be in the next build of Teneo (one of coming days).
>
> gr. Martin
> <class name="library.impl.OneTimeWonderImpl" entity-name="OneTimeWonder"
> abstract="false" lazy="true" discriminator-value="OneTimeWonder"
> table="`onetimewonder`" proxy="library.OneTimeWonder">
> <meta attribute="eclassName">OneTimeWonder</meta>
> <meta
> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
> <id name="id" type="long" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="foreign">
> <param name="property">theAuthor</param>
> </generator>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="Name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <one-to-one name="theAuthor" entity-name="Author"
> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
> constrained="true"/>
> </class>
> <class name="library.impl.AuthorImpl" entity-name="Author"
> abstract="false" lazy="true" discriminator-value="Author" table="`author`"
> proxy="library.Author">
> <meta attribute="eclassName">Author</meta>
> <meta
> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
> <id name="id" type="long" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="Name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <one-to-one name="theBook" entity-name="OneTimeWonder"
> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
> </class>
>
>
> Phaneesh Nagaraja wrote:
>> For scenario 1: Many to one Relationship
>> Java code block:
>> Query bkquery = session.createQuery("FROM Book");
>>
>> List books = bkquery.list();
>>
>> //Get the size of the fetched book
>>
>> System.out.println(books.size());
>>
>>
>>
>> Output:
>>
>> 3 //No of books in the books table
>>
>>
>>
>> SQL Query fired:
>>
>>
>>
>> select book0_.e_id as e1_0_, book0_.e_version as e3_0_, book0_.`title` as
>> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as
>> category6_0_, book0_.`book_author_e_id` as book7_0_,
>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as e11_0_,
>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>
>>
>>
>> In the above query the writer table is not accessed as we have yet to
>> access any writer object.
>>
>>
>>
>> When I fetch the writer object object:
>>
>>
>>
>> Java Code block:
>>
>> Book iBook = (Book)books.get(0);
>>
>> Writer author = iBook.getAuthor();
>>
>> System.out.println(author.getName());
>>
>>
>>
>> SQL query fired:
>>
>>
>>
>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>> writer0_.e_id=?
>>
>>
>>
>> In the above query, the writer table is accessed when I fetch the author
>> of the book which is an Writer object.
>>
>>
>>
>> Output:
>>
>> JRR Tolkien //Name of the author
>>
>>
>>
>> For Scenario 2: One to One relationship
>>
>>
>>
>> Java Code Block:
>>
>> Query otwquery = session.createQuery("From
>> OneTimeWonder");
>>
>> List onetimeWonders = otwquery.list();
>>
>> System.out.println(onetimeWonders.size());
>>
>>
>>
>> SQL query fired:
>>
>>
>>
>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>> library0_.`name` as name4_1_0_ from `library` library0_ where
>> library0_.e_id=?
>>
>>
>>
>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>> writer0_.e_id=?
>>
>>
>>
>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>> writer0_.e_id=?
>>
>>
>>
>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>> library0_.`name` as name4_1_0_ from `library` library0_ where
>> library0_.e_id=?
>>
>>
>>
>> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
>> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>
>>
>>
>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>> `author` author0_ where author0_.theBook=?
>>
>>
>>
>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>> `author` author0_ where author0_.theBook=?
>>
>>
>>
>> The above set of queries indicate that all the information from writer
>> table, and author table is fetched eventhough I have not accessed the
>> writer or author.
>>
>>
>>
>> Output:
>>
>> 2 //Total records in OneTimeWonder table
>>
>>
>>
>>
>>
>> I have attached the ecore model and junit testcase which would be
>> sufficient to try it out.
>>
>>
>>
>> If you need any more info please let me know.
>>
>>
>>
>> Thanks
>>
>> Phaneesh
>>
>>
>>
>>
>>
>>
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:g6c66e$8dp$1@build.eclipse.org...
>>> Hi Phaneesh,
>>> Getting the list.size() generates a number of queries which I don't
>>> fully understand (the initial
>>> library and writer queries). Can you post the complete testcase?
>>> Let me know if I require anything else than the test case and the model
>>> to try this myself.
>>>
>>> gr. Martin
>>>
>>> Phaneesh Nagaraja wrote:
>>>> Hi Martin,
>>>>
>>>> Thanks you for the quick response.
>>>>
>>>> I checked twice. Author is not being fetched.
>>>>
>>>> Here are thed hibernate logs:
>>>>
>>>> Scenario 1 : One to One
>>>>
>>>>
>>>>
>>>> Query bkquery = session.createQuery("FROM Book");
>>>>
>>>> List books = bkquery.list();
>>>>
>>>> System.out.println(books.size());
>>>>
>>>>
>>>>
>>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>>> book0_.`category`
>>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>> e11_0_,
>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>
>>>> 3 // getting list size while writer is not yet fetched
>>>>
>>>>
>>>>
>>>> Book iBook = (Book)books.get(0);
>>>>
>>>> Writer author = iBook.getAuthor();
>>>>
>>>> System.out.println(author.getName());
>>>>
>>>>
>>>>
>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>> e3_2_0_,
>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>> writer0_.e_id=?
>>>>
>>>> JRR Tolkien //fetching the name of the writer for which the previous
>>>> query
>>>> was executed.
>>>>
>>>>
>>>>
>>>> Scenario 2 : One to One
>>>>
>>>>
>>>>
>>>> Query otwquery = session.createQuery("From
>>>> OneTimeWonder");
>>>>
>>>> List onetimeWonders = otwquery.list();
>>>>
>>>> System.out.println(onetimeWonders.size());
>>>>
>>>>
>>>>
>>>> //All information queried while getting the size of the list
>>>>
>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>> e3_1_0_,
>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>> library0_.e_id=?
>>>>
>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>> e3_2_0_,
>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>> writer0_.e_id=?
>>>>
>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>> e3_2_0_,
>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>> writer0_.e_id=?
>>>>
>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>> e3_1_0_,
>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>> library0_.e_id=?
>>>>
>>>> Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as
>>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder`
>>>> onetimewon0_
>>>>
>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>> e3_5_0_,
>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>> `author`
>>>> author0_ where author0_.theBook=?
>>>>
>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>> e3_5_0_,
>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>> `author`
>>>> author0_ where author0_.theBook=?
>>>>
>>>> 2 //All information queried while getting the size of the list
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> When I try to get the size I see that all the info is fetched at once.
>>>>
>>>> Please let me know if I am missing something here.
>>>>
>>>>
>>>>
>>>> Thanks
>>>>
>>>> Phaneesh
>>>>
>>>>
>>>>
>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>> news:4888580F.9030401@elver.org...
>>>>> Hi Phaneesh,
>>>>> Can you check to be sure that the Author is not accidently already
>>>>> read
>>>>> into the session?
>>>>> See here for how to set hibernate logging which will show this:
>>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>>
>>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is now
>>>>> done
>>>>> there.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Phaneesh Nagaraja wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to use the proxying to improve the performance. I am
>>>>>> currently using teneo 1.0.
>>>>>> I tried two different scenarios in the library example;
>>>>>> Scenario 1:
>>>>>> Book -> Writer which is a Many-To-One relationship is getting
>>>>>> proxied.
>>>>>>
>>>>>> Scenario 2:
>>>>>> But OneTimeWonder -> Author which is a One-To-One relationship is not
>>>>>> getting proxied.
>>>>>>
>>>>>> I have attached both ecore and the mapping file that is getting
>>>>>> generated. Please help me out in understanding why proxying is not
>>>>>> working in case of scenario 2.
>>>>>>
>>>>>> Thanks
>>>>>> Phaneesh
>>>>> --
>>>>>
>>>>> With Regards, Martin Taal
>>>>>
>>>>> Springsite/Elver.org
>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>> The Netherlands
>>>>> Cell: +31 (0)6 288 48 943
>>>>> Tel: +31 (0)84 420 2397
>>>>> Fax: +31 (0)84 225 9307
>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>> Web: www.springsite.com - www.elver.org
>>>>
>>>
>>> --
>>>
>>> With Regards, Martin Taal
>>>
>>> Springsite/Elver.org
>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>> The Netherlands
>>> Cell: +31 (0)6 288 48 943
>>> Tel: +31 (0)84 420 2397
>>> Fax: +31 (0)84 225 9307
>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>> Web: www.springsite.com - www.elver.org
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421319 is a reply to message #421309] Mon, 04 August 2008 12:32 Go to previous messageGo to next message
Phaneesh Nagaraja is currently offline Phaneesh NagarajaFriend
Messages: 24
Registered: July 2009
Junior Member
Hi martin,

Can you send me the updated ecore>

Thanks
Phaneesh

"Martin Taal" <mtaal@elver.org> wrote in message
news:g74v64$t97$1@build.eclipse.org...
> Hi Phaneesh,
> I found the underlying cause of this not being handled as a proxy. The
> main thing is that Teneo did not map the relation correctly because it did
> not really treat it as a primarykeyjoincolumn. One reason was that there
> was no explicit id defined on the model. Teneo adds a synthetic id but
> this id does not support the foreign id-generator strategy. I won't change
> this as using synthetic id's is not recommended.
> So I added explicit id's to your model. The foreign generator was used
> correctly. Then I noticed that the mapping was not correct. For the case
> of a oto mapping with pk join columns there should be a oto on both sides.
> Teneo was placing a mto on one side. I needed to change the mapping logic.
> With the fix the one-to-one does not need to be specified, only the
> @PrimaryKeyJoinColumn on one side. See the attached ecore. Also the author
> was proxied correctly. Note that the proxy gets resolved when the test
> does otw.getAuthor() because the getAuthor() call does author.eIsProxy()
> which resolves the proxy.
>
> Here is the mapping, attached you can find the updated ecore. This fix
> will be in the next build of Teneo (one of coming days).
>
> gr. Martin
> <class name="library.impl.OneTimeWonderImpl" entity-name="OneTimeWonder"
> abstract="false" lazy="true" discriminator-value="OneTimeWonder"
> table="`onetimewonder`" proxy="library.OneTimeWonder">
> <meta attribute="eclassName">OneTimeWonder</meta>
> <meta
> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
> <id name="id" type="long" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="foreign">
> <param name="property">theAuthor</param>
> </generator>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="Name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <one-to-one name="theAuthor" entity-name="Author"
> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
> constrained="true"/>
> </class>
> <class name="library.impl.AuthorImpl" entity-name="Author"
> abstract="false" lazy="true" discriminator-value="Author" table="`author`"
> proxy="library.Author">
> <meta attribute="eclassName">Author</meta>
> <meta
> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
> <id name="id" type="long" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="Name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <one-to-one name="theBook" entity-name="OneTimeWonder"
> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
> </class>
>
>
> Phaneesh Nagaraja wrote:
>> For scenario 1: Many to one Relationship
>> Java code block:
>> Query bkquery = session.createQuery("FROM Book");
>>
>> List books = bkquery.list();
>>
>> //Get the size of the fetched book
>>
>> System.out.println(books.size());
>>
>>
>>
>> Output:
>>
>> 3 //No of books in the books table
>>
>>
>>
>> SQL Query fired:
>>
>>
>>
>> select book0_.e_id as e1_0_, book0_.e_version as e3_0_, book0_.`title` as
>> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as
>> category6_0_, book0_.`book_author_e_id` as book7_0_,
>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as e11_0_,
>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>
>>
>>
>> In the above query the writer table is not accessed as we have yet to
>> access any writer object.
>>
>>
>>
>> When I fetch the writer object object:
>>
>>
>>
>> Java Code block:
>>
>> Book iBook = (Book)books.get(0);
>>
>> Writer author = iBook.getAuthor();
>>
>> System.out.println(author.getName());
>>
>>
>>
>> SQL query fired:
>>
>>
>>
>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>> writer0_.e_id=?
>>
>>
>>
>> In the above query, the writer table is accessed when I fetch the author
>> of the book which is an Writer object.
>>
>>
>>
>> Output:
>>
>> JRR Tolkien //Name of the author
>>
>>
>>
>> For Scenario 2: One to One relationship
>>
>>
>>
>> Java Code Block:
>>
>> Query otwquery = session.createQuery("From
>> OneTimeWonder");
>>
>> List onetimeWonders = otwquery.list();
>>
>> System.out.println(onetimeWonders.size());
>>
>>
>>
>> SQL query fired:
>>
>>
>>
>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>> library0_.`name` as name4_1_0_ from `library` library0_ where
>> library0_.e_id=?
>>
>>
>>
>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>> writer0_.e_id=?
>>
>>
>>
>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>> writer0_.e_id=?
>>
>>
>>
>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>> library0_.`name` as name4_1_0_ from `library` library0_ where
>> library0_.e_id=?
>>
>>
>>
>> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
>> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>
>>
>>
>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>> `author` author0_ where author0_.theBook=?
>>
>>
>>
>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>> `author` author0_ where author0_.theBook=?
>>
>>
>>
>> The above set of queries indicate that all the information from writer
>> table, and author table is fetched eventhough I have not accessed the
>> writer or author.
>>
>>
>>
>> Output:
>>
>> 2 //Total records in OneTimeWonder table
>>
>>
>>
>>
>>
>> I have attached the ecore model and junit testcase which would be
>> sufficient to try it out.
>>
>>
>>
>> If you need any more info please let me know.
>>
>>
>>
>> Thanks
>>
>> Phaneesh
>>
>>
>>
>>
>>
>>
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:g6c66e$8dp$1@build.eclipse.org...
>>> Hi Phaneesh,
>>> Getting the list.size() generates a number of queries which I don't
>>> fully understand (the initial
>>> library and writer queries). Can you post the complete testcase?
>>> Let me know if I require anything else than the test case and the model
>>> to try this myself.
>>>
>>> gr. Martin
>>>
>>> Phaneesh Nagaraja wrote:
>>>> Hi Martin,
>>>>
>>>> Thanks you for the quick response.
>>>>
>>>> I checked twice. Author is not being fetched.
>>>>
>>>> Here are thed hibernate logs:
>>>>
>>>> Scenario 1 : One to One
>>>>
>>>>
>>>>
>>>> Query bkquery = session.createQuery("FROM Book");
>>>>
>>>> List books = bkquery.list();
>>>>
>>>> System.out.println(books.size());
>>>>
>>>>
>>>>
>>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>>> book0_.`category`
>>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>> e11_0_,
>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>
>>>> 3 // getting list size while writer is not yet fetched
>>>>
>>>>
>>>>
>>>> Book iBook = (Book)books.get(0);
>>>>
>>>> Writer author = iBook.getAuthor();
>>>>
>>>> System.out.println(author.getName());
>>>>
>>>>
>>>>
>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>> e3_2_0_,
>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>> writer0_.e_id=?
>>>>
>>>> JRR Tolkien //fetching the name of the writer for which the previous
>>>> query
>>>> was executed.
>>>>
>>>>
>>>>
>>>> Scenario 2 : One to One
>>>>
>>>>
>>>>
>>>> Query otwquery = session.createQuery("From
>>>> OneTimeWonder");
>>>>
>>>> List onetimeWonders = otwquery.list();
>>>>
>>>> System.out.println(onetimeWonders.size());
>>>>
>>>>
>>>>
>>>> //All information queried while getting the size of the list
>>>>
>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>> e3_1_0_,
>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>> library0_.e_id=?
>>>>
>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>> e3_2_0_,
>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>> writer0_.e_id=?
>>>>
>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>> e3_2_0_,
>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>> writer0_.e_id=?
>>>>
>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>> e3_1_0_,
>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>> library0_.e_id=?
>>>>
>>>> Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as
>>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder`
>>>> onetimewon0_
>>>>
>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>> e3_5_0_,
>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>> `author`
>>>> author0_ where author0_.theBook=?
>>>>
>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>> e3_5_0_,
>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>> `author`
>>>> author0_ where author0_.theBook=?
>>>>
>>>> 2 //All information queried while getting the size of the list
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> When I try to get the size I see that all the info is fetched at once.
>>>>
>>>> Please let me know if I am missing something here.
>>>>
>>>>
>>>>
>>>> Thanks
>>>>
>>>> Phaneesh
>>>>
>>>>
>>>>
>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>> news:4888580F.9030401@elver.org...
>>>>> Hi Phaneesh,
>>>>> Can you check to be sure that the Author is not accidently already
>>>>> read
>>>>> into the session?
>>>>> See here for how to set hibernate logging which will show this:
>>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>>
>>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is now
>>>>> done
>>>>> there.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Phaneesh Nagaraja wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to use the proxying to improve the performance. I am
>>>>>> currently using teneo 1.0.
>>>>>> I tried two different scenarios in the library example;
>>>>>> Scenario 1:
>>>>>> Book -> Writer which is a Many-To-One relationship is getting
>>>>>> proxied.
>>>>>>
>>>>>> Scenario 2:
>>>>>> But OneTimeWonder -> Author which is a One-To-One relationship is not
>>>>>> getting proxied.
>>>>>>
>>>>>> I have attached both ecore and the mapping file that is getting
>>>>>> generated. Please help me out in understanding why proxying is not
>>>>>> working in case of scenario 2.
>>>>>>
>>>>>> Thanks
>>>>>> Phaneesh
>>>>> --
>>>>>
>>>>> With Regards, Martin Taal
>>>>>
>>>>> Springsite/Elver.org
>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>> The Netherlands
>>>>> Cell: +31 (0)6 288 48 943
>>>>> Tel: +31 (0)84 420 2397
>>>>> Fax: +31 (0)84 225 9307
>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>> Web: www.springsite.com - www.elver.org
>>>>
>>>
>>> --
>>>
>>> With Regards, Martin Taal
>>>
>>> Springsite/Elver.org
>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>> The Netherlands
>>> Cell: +31 (0)6 288 48 943
>>> Tel: +31 (0)84 420 2397
>>> Fax: +31 (0)84 225 9307
>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>> Web: www.springsite.com - www.elver.org
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421320 is a reply to message #421319] Mon, 04 August 2008 12:44 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000502030205080206000809
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi Phaneesh,
Here it is together with the generated hbm (I added your example to the Teneo test cases).

Note that the bugfix will be available in a few days. I want to solve some more bugzillas before
doing a new build.

gr. Martin

Phaneesh Nagaraja wrote:
> Hi martin,
>
> Can you send me the updated ecore>
>
> Thanks
> Phaneesh
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:g74v64$t97$1@build.eclipse.org...
>> Hi Phaneesh,
>> I found the underlying cause of this not being handled as a proxy. The
>> main thing is that Teneo did not map the relation correctly because it did
>> not really treat it as a primarykeyjoincolumn. One reason was that there
>> was no explicit id defined on the model. Teneo adds a synthetic id but
>> this id does not support the foreign id-generator strategy. I won't change
>> this as using synthetic id's is not recommended.
>> So I added explicit id's to your model. The foreign generator was used
>> correctly. Then I noticed that the mapping was not correct. For the case
>> of a oto mapping with pk join columns there should be a oto on both sides.
>> Teneo was placing a mto on one side. I needed to change the mapping logic.
>> With the fix the one-to-one does not need to be specified, only the
>> @PrimaryKeyJoinColumn on one side. See the attached ecore. Also the author
>> was proxied correctly. Note that the proxy gets resolved when the test
>> does otw.getAuthor() because the getAuthor() call does author.eIsProxy()
>> which resolves the proxy.
>>
>> Here is the mapping, attached you can find the updated ecore. This fix
>> will be in the next build of Teneo (one of coming days).
>>
>> gr. Martin
>> <class name="library.impl.OneTimeWonderImpl" entity-name="OneTimeWonder"
>> abstract="false" lazy="true" discriminator-value="OneTimeWonder"
>> table="`onetimewonder`" proxy="library.OneTimeWonder">
>> <meta attribute="eclassName">OneTimeWonder</meta>
>> <meta
>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>> <id name="id" type="long" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="foreign">
>> <param name="property">theAuthor</param>
>> </generator>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="Name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <one-to-one name="theAuthor" entity-name="Author"
>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>> constrained="true"/>
>> </class>
>> <class name="library.impl.AuthorImpl" entity-name="Author"
>> abstract="false" lazy="true" discriminator-value="Author" table="`author`"
>> proxy="library.Author">
>> <meta attribute="eclassName">Author</meta>
>> <meta
>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>> <id name="id" type="long" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="native"/>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="Name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>> </class>
>>
>>
>> Phaneesh Nagaraja wrote:
>>> For scenario 1: Many to one Relationship
>>> Java code block:
>>> Query bkquery = session.createQuery("FROM Book");
>>>
>>> List books = bkquery.list();
>>>
>>> //Get the size of the fetched book
>>>
>>> System.out.println(books.size());
>>>
>>>
>>>
>>> Output:
>>>
>>> 3 //No of books in the books table
>>>
>>>
>>>
>>> SQL Query fired:
>>>
>>>
>>>
>>> select book0_.e_id as e1_0_, book0_.e_version as e3_0_, book0_.`title` as
>>> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as
>>> category6_0_, book0_.`book_author_e_id` as book7_0_,
>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as e11_0_,
>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>
>>>
>>>
>>> In the above query the writer table is not accessed as we have yet to
>>> access any writer object.
>>>
>>>
>>>
>>> When I fetch the writer object object:
>>>
>>>
>>>
>>> Java Code block:
>>>
>>> Book iBook = (Book)books.get(0);
>>>
>>> Writer author = iBook.getAuthor();
>>>
>>> System.out.println(author.getName());
>>>
>>>
>>>
>>> SQL query fired:
>>>
>>>
>>>
>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>> writer0_.e_id=?
>>>
>>>
>>>
>>> In the above query, the writer table is accessed when I fetch the author
>>> of the book which is an Writer object.
>>>
>>>
>>>
>>> Output:
>>>
>>> JRR Tolkien //Name of the author
>>>
>>>
>>>
>>> For Scenario 2: One to One relationship
>>>
>>>
>>>
>>> Java Code Block:
>>>
>>> Query otwquery = session.createQuery("From
>>> OneTimeWonder");
>>>
>>> List onetimeWonders = otwquery.list();
>>>
>>> System.out.println(onetimeWonders.size());
>>>
>>>
>>>
>>> SQL query fired:
>>>
>>>
>>>
>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>> library0_.e_id=?
>>>
>>>
>>>
>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>> writer0_.e_id=?
>>>
>>>
>>>
>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>> writer0_.e_id=?
>>>
>>>
>>>
>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>> library0_.e_id=?
>>>
>>>
>>>
>>> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
>>> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>>
>>>
>>>
>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>> `author` author0_ where author0_.theBook=?
>>>
>>>
>>>
>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>> `author` author0_ where author0_.theBook=?
>>>
>>>
>>>
>>> The above set of queries indicate that all the information from writer
>>> table, and author table is fetched eventhough I have not accessed the
>>> writer or author.
>>>
>>>
>>>
>>> Output:
>>>
>>> 2 //Total records in OneTimeWonder table
>>>
>>>
>>>
>>>
>>>
>>> I have attached the ecore model and junit testcase which would be
>>> sufficient to try it out.
>>>
>>>
>>>
>>> If you need any more info please let me know.
>>>
>>>
>>>
>>> Thanks
>>>
>>> Phaneesh
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>> news:g6c66e$8dp$1@build.eclipse.org...
>>>> Hi Phaneesh,
>>>> Getting the list.size() generates a number of queries which I don't
>>>> fully understand (the initial
>>>> library and writer queries). Can you post the complete testcase?
>>>> Let me know if I require anything else than the test case and the model
>>>> to try this myself.
>>>>
>>>> gr. Martin
>>>>
>>>> Phaneesh Nagaraja wrote:
>>>>> Hi Martin,
>>>>>
>>>>> Thanks you for the quick response.
>>>>>
>>>>> I checked twice. Author is not being fetched.
>>>>>
>>>>> Here are thed hibernate logs:
>>>>>
>>>>> Scenario 1 : One to One
>>>>>
>>>>>
>>>>>
>>>>> Query bkquery = session.createQuery("FROM Book");
>>>>>
>>>>> List books = bkquery.list();
>>>>>
>>>>> System.out.println(books.size());
>>>>>
>>>>>
>>>>>
>>>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>>>> book0_.`category`
>>>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>> e11_0_,
>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>
>>>>> 3 // getting list size while writer is not yet fetched
>>>>>
>>>>>
>>>>>
>>>>> Book iBook = (Book)books.get(0);
>>>>>
>>>>> Writer author = iBook.getAuthor();
>>>>>
>>>>> System.out.println(author.getName());
>>>>>
>>>>>
>>>>>
>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>> e3_2_0_,
>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>>> writer0_.e_id=?
>>>>>
>>>>> JRR Tolkien //fetching the name of the writer for which the previous
>>>>> query
>>>>> was executed.
>>>>>
>>>>>
>>>>>
>>>>> Scenario 2 : One to One
>>>>>
>>>>>
>>>>>
>>>>> Query otwquery = session.createQuery("From
>>>>> OneTimeWonder");
>>>>>
>>>>> List onetimeWonders = otwquery.list();
>>>>>
>>>>> System.out.println(onetimeWonders.size());
>>>>>
>>>>>
>>>>>
>>>>> //All information queried while getting the size of the list
>>>>>
>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>> e3_1_0_,
>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>> library0_.e_id=?
>>>>>
>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>> e3_2_0_,
>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>>> writer0_.e_id=?
>>>>>
>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>> e3_2_0_,
>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>>> writer0_.e_id=?
>>>>>
>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>> e3_1_0_,
>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>> library0_.e_id=?
>>>>>
>>>>> Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as
>>>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder`
>>>>> onetimewon0_
>>>>>
>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>> e3_5_0_,
>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>> `author`
>>>>> author0_ where author0_.theBook=?
>>>>>
>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>> e3_5_0_,
>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>> `author`
>>>>> author0_ where author0_.theBook=?
>>>>>
>>>>> 2 //All information queried while getting the size of the list
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> When I try to get the size I see that all the info is fetched at once.
>>>>>
>>>>> Please let me know if I am missing something here.
>>>>>
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>> Phaneesh
>>>>>
>>>>>
>>>>>
>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>> news:4888580F.9030401@elver.org...
>>>>>> Hi Phaneesh,
>>>>>> Can you check to be sure that the Author is not accidently already
>>>>>> read
>>>>>> into the session?
>>>>>> See here for how to set hibernate logging which will show this:
>>>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>>>
>>>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is now
>>>>>> done
>>>>>> there.
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Phaneesh Nagaraja wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am trying to use the proxying to improve the performance. I am
>>>>>>> currently using teneo 1.0.
>>>>>>> I tried two different scenarios in the library example;
>>>>>>> Scenario 1:
>>>>>>> Book -> Writer which is a Many-To-One relationship is getting
>>>>>>> proxied.
>>>>>>>
>>>>>>> Scenario 2:
>>>>>>> But OneTimeWonder -> Author which is a One-To-One relationship is not
>>>>>>> getting proxied.
>>>>>>>
>>>>>>> I have attached both ecore and the mapping file that is getting
>>>>>>> generated. Please help me out in understanding why proxying is not
>>>>>>> working in case of scenario 2.
>>>>>>>
>>>>>>> Thanks
>>>>>>> Phaneesh
>>>>>> --
>>>>>>
>>>>>> With Regards, Martin Taal
>>>>>>
>>>>>> Springsite/Elver.org
>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>> The Netherlands
>>>>>> Cell: +31 (0)6 288 48 943
>>>>>> Tel: +31 (0)84 420 2397
>>>>>> Fax: +31 (0)84 225 9307
>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>> Web: www.springsite.com - www.elver.org
>>>> --
>>>>
>>>> With Regards, Martin Taal
>>>>
>>>> Springsite/Elver.org
>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>> The Netherlands
>>>> Cell: +31 (0)6 288 48 943
>>>> Tel: +31 (0)84 420 2397
>>>> Fax: +31 (0)84 225 9307
>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>> Web: www.springsite.com - www.elver.org
>>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> Cell: +31 (0)6 288 48 943
>> Tel: +31 (0)84 420 2397
>> Fax: +31 (0)84 225 9307
>> Mail: mtaal@springsite.com - mtaal@elver.org
>> Web: www.springsite.com - www.elver.org
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org

--------------000502030205080206000809
Content-Type: text/xml;
name="Bz242995Action_mysql_a_o_hibernate.hbm.xml"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="Bz242995Action_mysql_a_o_hibernate.hbm.xml"

PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NU WVBFIGhpYmVy
bmF0ZS1tYXBwaW5nIFBVQkxJQyAiLS8vSGliZXJuYXRlL0hpYmVybmF0ZSBN YXBwaW5nIERU
RCAzLjAvL0VOIiAiaHR0cDovL2hpYmVybmF0ZS5zb3VyY2Vmb3JnZS5uZXQv aGliZXJuYXRl
LW1hcHBpbmctMy4wLmR0ZCI+Cgo8aGliZXJuYXRlLW1hcHBpbmcgYXV0by1p bXBvcnQ9ImZh
bHNlIj4KCTxjbGFzcyBuYW1lPSJvcmcuZWNsaXBzZS5lbWYudGVuZW8uc2Ft cGxlcy5pc3N1
ZXMuYnoyNDI5OTUuaW1wbC5Cb29rSW1wbCIgZW50aXR5LW5hbWU9IkJvb2si IGFic3RyYWN0
PSJmYWxzZSIgbGF6eT0idHJ1ZSIgZGlzY3JpbWluYXRvci12YWx1ZT0iQm9v ayIgdGFibGU9
ImBib29rYCIgcHJveHk9Im9yZy5lY2xpcHNlLmVtZi50ZW5lby5zYW1wbGVz Lmlzc3Vlcy5i
ejI0Mjk5NS5Cb29rIj4KCQk8bWV0YSBhdHRyaWJ1dGU9ImVjbGFzc05hbWUi PkJvb2s8L21l
dGE+CgkJPG1ldGEgYXR0cmlidXRlPSJlcGFja2FnZSI+aHR0cDovLy9vcmcv ZWNsaXBzZS9l
eGFtcGxlL2xpYnJhcnkuZWNvcmU8L21ldGE+CgkJPGlkIHR5cGU9Imxvbmci IG5hbWU9ImVf
aWQiIGNvbHVtbj0iZV9pZCIgYWNjZXNzPSJvcmcuZWNsaXBzZS5lbWYudGVu ZW8uaGliZXJu
YXRlLm1hcHBpbmcuaWRlbnRpZmllci5JZGVudGlmaWVyUHJvcGVydHlIYW5k bGVyIj4KCQkJ
PG1ldGEgYXR0cmlidXRlPSJzeW50aGV0aWNJZCI+dHJ1ZTwvbWV0YT4KCQkJ PGdlbmVyYXRv
ciBjbGFzcz0ibmF0aXZlIi8+CgkJPC9pZD4KCQk8ZGlzY3JpbWluYXRvciBj b2x1bW49ImBk
dHlwZWAiIHR5cGU9InN0cmluZyIvPgoJCTx2ZXJzaW9uIG5hbWU9ImVfdmVy c2lvbiIgY29s
dW1uPSJlX3ZlcnNpb24iIGFjY2Vzcz0ib3JnLmVjbGlwc2UuZW1mLnRlbmVv LmhpYmVybmF0
ZS5tYXBwaW5nLnByb3BlcnR5LlZlcnNpb25Qcm9wZXJ0eUhhbmRsZXIiPgoJ CQk8bWV0YSBh
dHRyaWJ1dGU9InN5bnRoZXRpY1ZlcnNpb24iPnRydWU8L21ldGE+CgkJPC92 ZXJzaW9uPgoJ
CTxwcm9wZXJ0eSBuYW1lPSJ0aXRsZSIgbGF6eT0iZmFsc2UiIGluc2VydD0i dHJ1ZSIgdXBk
YXRlPSJ0cnVlIiBub3QtbnVsbD0iZmFsc2UiIHVuaXF1ZT0iZmFsc2UiIHR5 cGU9ImphdmEu
bGFuZy5TdHJpbmciPgoJCQk8Y29sdW1uIG5vdC1udWxsPSJmYWxzZSIgdW5p cXVlPSJmYWxz
ZSIgbmFtZT0iYHRpdGxlYCIvPgoJCTwvcHJvcGVydHk+CgkJPHByb3BlcnR5 IG5hbWU9InBh
Z2VzIiBsYXp5PSJmYWxzZSIgaW5zZXJ0PSJ0cnVlIiB1cGRhdGU9InRydWUi IG5vdC1udWxs
PSJmYWxzZSIgdW5pcXVlPSJmYWxzZSIgdHlwZT0iaW50Ij4KCQkJPGNvbHVt biBub3QtbnVs
bD0iZmFsc2UiIHVuaXF1ZT0iZmFsc2UiIG5hbWU9ImBwYWdlc2AiLz4KCQk8 L3Byb3BlcnR5
PgoJCTxwcm9wZXJ0eSBuYW1lPSJjYXRlZ29yeSIgbGF6eT0iZmFsc2UiIG5v dC1udWxsPSJm
YWxzZSIgaW5zZXJ0PSJ0cnVlIiB1cGRhdGU9InRydWUiIHVuaXF1ZT0iZmFs c2UiPgoJCQk8
Y29sdW1uIG5vdC1udWxsPSJmYWxzZSIgdW5pcXVlPSJmYWxzZSIgbmFtZT0i YGNhdGVnb3J5
YCIvPgoJCQk8dHlwZSBuYW1lPSJvcmcuZWNsaXBzZS5lbWYudGVuZW8uaGli ZXJuYXRlLm1h
cHBpbmcuRU51bVVzZXJUeXBlIj4KCQkJCTxwYXJhbSBuYW1lPSJlbnVtQ2xh c3MiPm9yZy5l
Y2xpcHNlLmVtZi50ZW5lby5zYW1wbGVzLmlzc3Vlcy5iejI0Mjk5NS5Cb29r Q2F0ZWdvcnk8
L3BhcmFtPgoJCQk8L3R5cGU+CgkJPC9wcm9wZXJ0eT4KCQk8bWFueS10by1v bmUgbmFtZT0i
YXV0aG9yIiBlbnRpdHktbmFtZT0iV3JpdGVyIiBjYXNjYWRlPSJtZXJnZSxw ZXJzaXN0LHNh
dmUtdXBkYXRlLGxvY2sscmVmcmVzaCIgZm9yZWlnbi1rZXk9ImJvb2tfYXV0 aG9yIiBsYXp5
PSJwcm94eSIgaW5zZXJ0PSJmYWxzZSIgdXBkYXRlPSJmYWxzZSIgbm90LW51 bGw9ImZhbHNl
Ij4KCQkJPGNvbHVtbiBub3QtbnVsbD0iZmFsc2UiIHVuaXF1ZT0iZmFsc2Ui IG5hbWU9ImBi
b29rX2F1dGhvcl9lX2lkYCIvPgoJCTwvbWFueS10by1vbmU+Cgk8L2NsYXNz PgoJPGNsYXNz
IG5hbWU9Im9yZy5lY2xpcHNlLmVtZi50ZW5lby5zYW1wbGVzLmlzc3Vlcy5i ejI0Mjk5NS5p
bXBsLkxpYnJhcnlJbXBsIiBlbnRpdHktbmFtZT0iTGlicmFyeSIgYWJzdHJh Y3Q9ImZhbHNl
IiBsYXp5PSJ0cnVlIiBkaXNjcmltaW5hdG9yLXZhbHVlPSJMaWJyYXJ5IiB0 YWJsZT0iYGxp
YnJhcnlgIiBwcm94eT0ib3JnLmVjbGlwc2UuZW1mLnRlbmVvLnNhbXBsZXMu aXNzdWVzLmJ6
MjQyOTk1LkxpYnJhcnkiPgoJCTxtZXRhIGF0dHJpYnV0ZT0iZWNsYXNzTmFt ZSI+TGlicmFy
eTwvbWV0YT4KCQk8bWV0YSBhdHRyaWJ1dGU9ImVwYWNrYWdlIj5odHRwOi8v L29yZy9lY2xp
cHNlL2V4YW1wbGUvbGlicmFyeS5lY29yZTwvbWV0YT4KCQk8aWQgdHlwZT0i bG9uZyIgbmFt
ZT0iZV9pZCIgY29sdW1uPSJlX2lkIiBhY2Nlc3M9Im9yZy5lY2xpcHNlLmVt Zi50ZW5lby5o
aWJlcm5hdGUubWFwcGluZy5pZGVudGlmaWVyLklkZW50aWZpZXJQcm9wZXJ0 eUhhbmRsZXIi
PgoJCQk8bWV0YSBhdHRyaWJ1dGU9InN5bnRoZXRpY0lkIj50cnVlPC9tZXRh PgoJCQk8Z2Vu
ZXJhdG9yIGNsYXNzPSJuYXRpdmUiLz4KCQk8L2lkPgoJCTxkaXNjcmltaW5h dG9yIGNvbHVt
bj0iYGR0eXBlYCIgdHlwZT0ic3RyaW5nIi8+CgkJPHZlcnNpb24gbmFtZT0i ZV92ZXJzaW9u
IiBjb2x1bW49ImVfdmVyc2lvbiIgYWNjZXNzPSJvcmcuZWNsaXBzZS5lbWYu dGVuZW8uaGli
ZXJuYXRlLm1hcHBpbmcucHJvcGVydHkuVmVyc2lvblByb3BlcnR5SGFuZGxl ciI+CgkJCTxt
ZXRhIGF0dHJpYnV0ZT0ic3ludGhldGljVmVyc2lvbiI+dHJ1ZTwvbWV0YT4K CQk8L3ZlcnNp
b24+CgkJPHByb3BlcnR5IG5hbWU9Im5hbWUiIGxhenk9ImZhbHNlIiBpbnNl cnQ9InRydWUi
IHVwZGF0ZT0idHJ1ZSIgbm90LW51bGw9ImZhbHNlIiB1bmlxdWU9ImZhbHNl IiB0eXBlPSJq
YXZhLmxhbmcuU3RyaW5nIj4KCQkJPGNvbHVtbiBub3QtbnVsbD0iZmFsc2Ui IHVuaXF1ZT0i
ZmFsc2UiIG5hbWU9ImBuYW1lYCIvPgoJCTwvcHJvcGVydHk+CgkJPGxpc3Qg bmFtZT0id3Jp
dGVycyIgbGF6eT0idHJ1ZSIgY2FzY2FkZT0iYWxsLGRlbGV0ZS1vcnBoYW4i PgoJCQk8a2V5
IHVwZGF0ZT0idHJ1ZSIgZm9yZWlnbi1rZXk9ImxpYnJhcnlfd3JpdGVycyI+ CgkJCQk8Y29s
dW1uIG5hbWU9ImBsaWJyYXJ5X3dyaXRlcnNfZV9pZGAiIG5vdC1udWxsPSJm YWxzZSIgdW5p
cXVlPSJmYWxzZSIvPgoJCQk8L2tleT4KCQkJPGxpc3QtaW5kZXggY29sdW1u PSJgbGlicmFy
eV93cml0ZXJzX2lkeGAiLz4KCQkJPG9uZS10by1tYW55IGVudGl0eS1uYW1l PSJXcml0ZXIi
Lz4KCQk8L2xpc3Q+CgkJPGxpc3QgbmFtZT0iYm9va3MiIGxhenk9InRydWUi IGNhc2NhZGU9
ImFsbCxkZWxldGUtb3JwaGFuIj4KCQkJPGtleSB1cGRhdGU9InRydWUiIGZv cmVpZ24ta2V5
PSJsaWJyYXJ5X2Jvb2tzIj4KCQkJCTxjb2x1bW4gbmFtZT0iYGxpYnJhcnlf Ym9va3NfZV9p
ZGAiIG5vdC1udWxsPSJmYWxzZSIgdW5pcXVlPSJmYWxzZSIvPgoJCQk8L2tl eT4KCQkJPGxp
c3QtaW5kZXggY29sdW1uPSJgbGlicmFyeV9ib29rc19pZHhgIi8+CgkJCTxv bmUtdG8tbWFu
eSBlbnRpdHktbmFtZT0iQm9vayIvPgoJCTwvbGlzdD4KCTwvY2xhc3M+Cgk8 Y2xhc3MgbmFt
ZT0ib3JnLmVjbGlwc2UuZW1mLnRlbmVvLnNhbXBsZXMuaXNzdWVzLmJ6MjQy OTk1LmltcGwu
V3JpdGVySW1wbCIgZW50aXR5LW5hbWU9IldyaXRlciIgYWJzdHJhY3Q9ImZh bHNlIiBsYXp5
PSJ0cnVlIiBkaXNjcmltaW5hdG9yLXZhbHVlPSJXcml0ZXIiIHRhYmxlPSJg d3JpdGVyYCIg
cHJveHk9Im9yZy5lY2xpcHNlLmVtZi50ZW5lby5zYW1wbGVzLmlzc3Vlcy5i ejI0Mjk5NS5X
cml0ZXIiPgoJCTxtZXRhIGF0dHJpYnV0ZT0iZWNsYXNzTmFtZSI+V3JpdGVy PC9tZXRhPgoJ
CTxtZXRhIGF0dHJpYnV0ZT0iZXBhY2thZ2UiPmh0dHA6Ly8vb3JnL2VjbGlw c2UvZXhhbXBs
ZS9saWJyYXJ5LmVjb3JlPC9tZXRhPgoJCTxpZCB0eXBlPSJsb25nIiBuYW1l PSJlX2lkIiBj
b2x1bW49ImVfaWQiIGFjY2Vzcz0ib3JnLmVjbGlwc2UuZW1mLnRlbmVvLmhp YmVybmF0ZS5t
YXBwaW5nLmlkZW50aWZpZXIuSWRlbnRpZmllclByb3BlcnR5SGFuZGxlciI+ CgkJCTxtZXRh
IGF0dHJpYnV0ZT0ic3ludGhldGljSWQiPnRydWU8L21ldGE+CgkJCTxnZW5l cmF0b3IgY2xh
c3M9Im5hdGl2ZSIvPgoJCTwvaWQ+CgkJPGRpc2NyaW1pbmF0b3IgY29sdW1u PSJgZHR5cGVg
IiB0eXBlPSJzdHJpbmciLz4KCQk8dmVyc2lvbiBuYW1lPSJlX3ZlcnNpb24i IGNvbHVtbj0i
ZV92ZXJzaW9uIiBhY2Nlc3M9Im9yZy5lY2xpcHNlLmVtZi50ZW5lby5oaWJl cm5hdGUubWFw
cGluZy5wcm9wZXJ0eS5WZXJzaW9uUHJvcGVydHlIYW5kbGVyIj4KCQkJPG1l dGEgYXR0cmli
dXRlPSJzeW50aGV0aWNWZXJzaW9uIj50cnVlPC9tZXRhPgoJCTwvdmVyc2lv bj4KCQk8cHJv
cGVydHkgbmFtZT0ibmFtZSIgbGF6eT0iZmFsc2UiIGluc2VydD0idHJ1ZSIg dXBkYXRlPSJ0
cnVlIiBub3QtbnVsbD0iZmFsc2UiIHVuaXF1ZT0iZmFsc2UiIHR5cGU9Imph dmEubGFuZy5T
dHJpbmciPgoJCQk8Y29sdW1uIG5vdC1udWxsPSJmYWxzZSIgdW5pcXVlPSJm YWxzZSIgbmFt
ZT0iYG5hbWVgIi8+CgkJPC9wcm9wZXJ0eT4KCQk8bGlzdCBuYW1lPSJib29r cyIgbGF6eT0i
dHJ1ZSIgY2FzY2FkZT0ibWVyZ2UscGVyc2lzdCxzYXZlLXVwZGF0ZSxsb2Nr LHJlZnJlc2gi
PgoJCQk8a2V5IHVwZGF0ZT0idHJ1ZSI+CgkJCQk8Y29sdW1uIG5hbWU9ImBi b29rX2F1dGhv
cl9lX2lkYCIgbm90LW51bGw9ImZhbHNlIiB1bmlxdWU9ImZhbHNlIi8+CgkJ CTwva2V5PgoJ
CQk8bGlzdC1pbmRleCBjb2x1bW49ImB3cml0ZXJfYm9va3NfaWR4YCIvPgoJ CQk8b25lLXRv
LW1hbnkgZW50aXR5LW5hbWU9IkJvb2siLz4KCQk8L2xpc3Q+Cgk8L2NsYXNz PgoJPGNsYXNz
IG5hbWU9Im9yZy5lY2xpcHNlLmVtZi50ZW5lby5zYW1wbGVzLmlzc3Vlcy5i ejI0Mjk5NS5p
bXBsLk9uZVRpbWVXb25kZXJJbXBsIiBlbnRpdHktbmFtZT0iT25lVGltZVdv bmRlciIgYWJz
dHJhY3Q9ImZhbHNlIiBsYXp5PSJ0cnVlIiBkaXNjcmltaW5hdG9yLXZhbHVl PSJPbmVUaW1l
V29uZGVyIiB0YWJsZT0iYG9uZXRpbWV3b25kZXJgIiBwcm94eT0ib3JnLmVj bGlwc2UuZW1m
LnRlbmVvLnNhbXBsZXMuaXNzdWVzLmJ6MjQyOTk1Lk9uZVRpbWVXb25kZXIi PgoJCTxtZXRh
IGF0dHJpYnV0ZT0iZWNsYXNzTmFtZSI+T25lVGltZVdvbmRlcjwvbWV0YT4K CQk8bWV0YSBh
dHRyaWJ1dGU9ImVwYWNrYWdlIj5odHRwOi8vL29yZy9lY2xpcHNlL2V4YW1w bGUvbGlicmFy
eS5lY29yZTwvbWV0YT4KCQk8aWQgbmFtZT0iaWQiIHR5cGU9ImxvbmciIHVu c2F2ZWQtdmFs
dWU9IjAiPgoJCQk8Y29sdW1uIG5vdC1udWxsPSJ0cnVlIiB1bmlxdWU9ImZh bHNlIiBuYW1l
PSJgaWRgIi8+CgkJCTxnZW5lcmF0b3IgY2xhc3M9ImZvcmVpZ24iPgoJCQkJ PHBhcmFtIG5h
bWU9InByb3BlcnR5Ij50aGVBdXRob3I8L3BhcmFtPgoJCQk8L2dlbmVyYXRv cj4KCQk8L2lk
PgoJCTxkaXNjcmltaW5hdG9yIGNvbHVtbj0iYGR0eXBlYCIgdHlwZT0ic3Ry aW5nIi8+CgkJ
PHZlcnNpb24gbmFtZT0iZV92ZXJzaW9uIiBjb2x1bW49ImVfdmVyc2lvbiIg YWNjZXNzPSJv
cmcuZWNsaXBzZS5lbWYudGVuZW8uaGliZXJuYXRlLm1hcHBpbmcucHJvcGVy dHkuVmVyc2lv
blByb3BlcnR5SGFuZGxlciI+CgkJCTxtZXRhIGF0dHJpYnV0ZT0ic3ludGhl dGljVmVyc2lv
biI+dHJ1ZTwvbWV0YT4KCQk8L3ZlcnNpb24+CgkJPHByb3BlcnR5IG5hbWU9 Ik5hbWUiIGxh
enk9ImZhbHNlIiBpbnNlcnQ9InRydWUiIHVwZGF0ZT0idHJ1ZSIgbm90LW51 bGw9ImZhbHNl
IiB1bmlxdWU9ImZhbHNlIiB0eXBlPSJqYXZhLmxhbmcuU3RyaW5nIj4KCQkJ PGNvbHVtbiBu
b3QtbnVsbD0iZmFsc2UiIHVuaXF1ZT0iZmFsc2UiIG5hbWU9ImBuYW1lYCIv PgoJCTwvcHJv
cGVydHk+CgkJPG9uZS10by1vbmUgbmFtZT0idGhlQXV0aG9yIiBlbnRpdHkt bmFtZT0iQXV0
aG9yIiBjYXNjYWRlPSJtZXJnZSxwZXJzaXN0LHNhdmUtdXBkYXRlLGxvY2ss cmVmcmVzaCIg
bGF6eT0icHJveHkiIGNvbnN0cmFpbmVkPSJ0cnVlIi8+Cgk8L2NsYXNzPgoJ PGNsYXNzIG5h
bWU9Im9yZy5lY2xpcHNlLmVtZi50ZW5lby5zYW1wbGVzLmlzc3Vlcy5iejI0 Mjk5NS5pbXBs
LkF1dGhvckltcGwiIGVudGl0eS1uYW1lPSJBdXRob3IiIGFic3RyYWN0PSJm YWxzZSIgbGF6
eT0idHJ1ZSIgZGlzY3JpbWluYXRvci12YWx1ZT0iQXV0aG9yIiB0YWJsZT0i YGF1dGhvcmAi
IHByb3h5PSJvcmcuZWNsaXBzZS5lbWYudGVuZW8uc2FtcGxlcy5pc3N1ZXMu YnoyNDI5OTUu
QXV0aG9yIj4KCQk8bWV0YSBhdHRyaWJ1dGU9ImVjbGFzc05hbWUiPkF1dGhv cjwvbWV0YT4K
CQk8bWV0YSBhdHRyaWJ1dGU9ImVwYWNrYWdlIj5odHRwOi8vL29yZy9lY2xp cHNlL2V4YW1w
bGUvbGlicmFyeS5lY29yZTwvbWV0YT4KCQk8aWQgbmFtZT0iaWQiIHR5cGU9 ImxvbmciIHVu
c2F2ZWQtdmFsdWU9IjAiPgoJCQk8Y29sdW1uIG5vdC1udWxsPSJ0cnVlIiB1 bmlxdWU9ImZh
bHNlIiBuYW1lPSJgaWRgIi8+CgkJCTxnZW5lcmF0b3IgY2xhc3M9Im5hdGl2 ZSIvPgoJCTwv
aWQ+CgkJPGRpc2NyaW1pbmF0b3IgY29sdW1uPSJgZHR5cGVgIiB0eXBlPSJz dHJpbmciLz4K
CQk8dmVyc2lvbiBuYW1lPSJlX3ZlcnNpb24iIGNvbHVtbj0iZV92ZXJzaW9u IiBhY2Nlc3M9
Im9yZy5lY2xpcHNlLmVtZi50ZW5lby5oaWJlcm5hdGUubWFwcGluZy5wcm9w ZXJ0eS5WZXJz
aW9uUHJvcGVydHlIYW5kbGVyIj4KCQkJPG1ldGEgYXR0cmlidXRlPSJzeW50 aGV0aWNWZXJz
aW9uIj50cnVlPC9tZXRhPgoJCTwvdmVyc2lvbj4KCQk8cHJvcGVydHkgbmFt ZT0iTmFtZSIg
bGF6eT0iZmFsc2UiIGluc2VydD0idHJ1ZSIgdXBkYXRlPSJ0cnVlIiBub3Qt bnVsbD0iZmFs
c2UiIHVuaXF1ZT0iZmFsc2UiIHR5cGU9ImphdmEubGFuZy5TdHJpbmciPgoJ CQk8Y29sdW1u
IG5vdC1udWxsPSJmYWxzZSIgdW5pcXVlPSJmYWxzZSIgbmFtZT0iYG5hbWVg Ii8+CgkJPC9w
cm9wZXJ0eT4KCQk8b25lLXRvLW9uZSBuYW1lPSJ0aGVCb29rIiBlbnRpdHkt bmFtZT0iT25l
VGltZVdvbmRlciIgY2FzY2FkZT0ibWVyZ2UscGVyc2lzdCxzYXZlLXVwZGF0 ZSxsb2NrLHJl
ZnJlc2giIGxhenk9InByb3h5Ii8+Cgk8L2NsYXNzPgo8L2hpYmVybmF0ZS1t YXBwaW5nPg==
--------------000502030205080206000809
Content-Type: text/xml;
name="library.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="library.ecore"

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bz242995"
nsURI="http:///org/eclipse/example/library.ecore" nsPrefix="org.eclipse.example.library">
<eClassifiers xsi:type="ecore:EClass" name="Book">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="title" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="pages" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="100"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="category" eType="#//BookCategory"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="author" lowerBound="1"
eType="#//Writer" eOpposite="#//Writer/books"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Library">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="writers" upperBound="-1"
eType="#//Writer" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="books" upperBound="-1"
eType="#//Book" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Writer">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="books" upperBound="-1"
eType="#//Book" eOpposite="#//Book/author"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="BookCategory">
<eLiterals name="Mystery"/>
<eLiterals name="ScienceFiction" value="1"/>
<eLiterals name="Biography" value="2"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OneTimeWonder">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="theAuthor" lowerBound="1"
eType="#//Author" eOpposite="#//Author/theBook">
<eAnnotations source="teneo.jpa">
<details key="value" value="@PrimaryKeyJoinColumn"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
<eAnnotations source="teneo.jpa">
<details key="value" value="@Id"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Author">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="theBook" lowerBound="1"
eType="#//OneTimeWonder" eOpposite="#//OneTimeWonder/theAuthor"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
<eAnnotations source="teneo.jpa">
<details key="value" value="@Id&#xA;@GeneratedValue"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>

--------------000502030205080206000809--
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421736 is a reply to message #421320] Tue, 12 August 2008 18:33 Go to previous messageGo to next message
Phaneesh Nagaraja is currently offline Phaneesh NagarajaFriend
Messages: 24
Registered: July 2009
Junior Member
Hi Martin,

Can you send me a patch of the changes that you did to solve the problem? If
code is already commited in cvs I will update the source I have.

Thanks
Phaneesh

"Martin Taal" <mtaal@elver.org> wrote in message
news:g76tim$75g$1@build.eclipse.org...
> Hi Phaneesh,
> Here it is together with the generated hbm (I added your example to the
> Teneo test cases).
>
> Note that the bugfix will be available in a few days. I want to solve some
> more bugzillas before
> doing a new build.
>
> gr. Martin
>
> Phaneesh Nagaraja wrote:
>> Hi martin,
>>
>> Can you send me the updated ecore>
>>
>> Thanks
>> Phaneesh
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:g74v64$t97$1@build.eclipse.org...
>>> Hi Phaneesh,
>>> I found the underlying cause of this not being handled as a proxy. The
>>> main thing is that Teneo did not map the relation correctly because it
>>> did
>>> not really treat it as a primarykeyjoincolumn. One reason was that there
>>> was no explicit id defined on the model. Teneo adds a synthetic id but
>>> this id does not support the foreign id-generator strategy. I won't
>>> change
>>> this as using synthetic id's is not recommended.
>>> So I added explicit id's to your model. The foreign generator was used
>>> correctly. Then I noticed that the mapping was not correct. For the case
>>> of a oto mapping with pk join columns there should be a oto on both
>>> sides.
>>> Teneo was placing a mto on one side. I needed to change the mapping
>>> logic.
>>> With the fix the one-to-one does not need to be specified, only the
>>> @PrimaryKeyJoinColumn on one side. See the attached ecore. Also the
>>> author
>>> was proxied correctly. Note that the proxy gets resolved when the test
>>> does otw.getAuthor() because the getAuthor() call does author.eIsProxy()
>>> which resolves the proxy.
>>>
>>> Here is the mapping, attached you can find the updated ecore. This fix
>>> will be in the next build of Teneo (one of coming days).
>>>
>>> gr. Martin
>>> <class name="library.impl.OneTimeWonderImpl" entity-name="OneTimeWonder"
>>> abstract="false" lazy="true" discriminator-value="OneTimeWonder"
>>> table="`onetimewonder`" proxy="library.OneTimeWonder">
>>> <meta attribute="eclassName">OneTimeWonder</meta>
>>> <meta
>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>> <id name="id" type="long" unsaved-value="0">
>>> <column not-null="true" unique="false" name="`id`"/>
>>> <generator class="foreign">
>>> <param name="property">theAuthor</param>
>>> </generator>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="Name" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`name`"/>
>>> </property>
>>> <one-to-one name="theAuthor" entity-name="Author"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>>> constrained="true"/>
>>> </class>
>>> <class name="library.impl.AuthorImpl" entity-name="Author"
>>> abstract="false" lazy="true" discriminator-value="Author"
>>> table="`author`"
>>> proxy="library.Author">
>>> <meta attribute="eclassName">Author</meta>
>>> <meta
>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>> <id name="id" type="long" unsaved-value="0">
>>> <column not-null="true" unique="false" name="`id`"/>
>>> <generator class="native"/>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="Name" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`name`"/>
>>> </property>
>>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>>> </class>
>>>
>>>
>>> Phaneesh Nagaraja wrote:
>>>> For scenario 1: Many to one Relationship
>>>> Java code block:
>>>> Query bkquery = session.createQuery("FROM Book");
>>>>
>>>> List books = bkquery.list();
>>>>
>>>> //Get the size of the fetched book
>>>>
>>>> System.out.println(books.size());
>>>>
>>>>
>>>>
>>>> Output:
>>>>
>>>> 3 //No of books in the books table
>>>>
>>>>
>>>>
>>>> SQL Query fired:
>>>>
>>>>
>>>>
>>>> select book0_.e_id as e1_0_, book0_.e_version as e3_0_, book0_.`title`
>>>> as
>>>> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as
>>>> category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>> e11_0_,
>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>
>>>>
>>>>
>>>> In the above query the writer table is not accessed as we have yet to
>>>> access any writer object.
>>>>
>>>>
>>>>
>>>> When I fetch the writer object object:
>>>>
>>>>
>>>>
>>>> Java Code block:
>>>>
>>>> Book iBook = (Book)books.get(0);
>>>>
>>>> Writer author = iBook.getAuthor();
>>>>
>>>> System.out.println(author.getName());
>>>>
>>>>
>>>>
>>>> SQL query fired:
>>>>
>>>>
>>>>
>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>> writer0_.e_id=?
>>>>
>>>>
>>>>
>>>> In the above query, the writer table is accessed when I fetch the
>>>> author
>>>> of the book which is an Writer object.
>>>>
>>>>
>>>>
>>>> Output:
>>>>
>>>> JRR Tolkien //Name of the author
>>>>
>>>>
>>>>
>>>> For Scenario 2: One to One relationship
>>>>
>>>>
>>>>
>>>> Java Code Block:
>>>>
>>>> Query otwquery = session.createQuery("From
>>>> OneTimeWonder");
>>>>
>>>> List onetimeWonders = otwquery.list();
>>>>
>>>> System.out.println(onetimeWonders.size());
>>>>
>>>>
>>>>
>>>> SQL query fired:
>>>>
>>>>
>>>>
>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>> library0_.e_id=?
>>>>
>>>>
>>>>
>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>> writer0_.e_id=?
>>>>
>>>>
>>>>
>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>> writer0_.e_id=?
>>>>
>>>>
>>>>
>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>> library0_.e_id=?
>>>>
>>>>
>>>>
>>>> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
>>>> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>>>
>>>>
>>>>
>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>> `author` author0_ where author0_.theBook=?
>>>>
>>>>
>>>>
>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>> `author` author0_ where author0_.theBook=?
>>>>
>>>>
>>>>
>>>> The above set of queries indicate that all the information from writer
>>>> table, and author table is fetched eventhough I have not accessed the
>>>> writer or author.
>>>>
>>>>
>>>>
>>>> Output:
>>>>
>>>> 2 //Total records in OneTimeWonder table
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> I have attached the ecore model and junit testcase which would be
>>>> sufficient to try it out.
>>>>
>>>>
>>>>
>>>> If you need any more info please let me know.
>>>>
>>>>
>>>>
>>>> Thanks
>>>>
>>>> Phaneesh
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>> news:g6c66e$8dp$1@build.eclipse.org...
>>>>> Hi Phaneesh,
>>>>> Getting the list.size() generates a number of queries which I don't
>>>>> fully understand (the initial
>>>>> library and writer queries). Can you post the complete testcase?
>>>>> Let me know if I require anything else than the test case and the
>>>>> model
>>>>> to try this myself.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Phaneesh Nagaraja wrote:
>>>>>> Hi Martin,
>>>>>>
>>>>>> Thanks you for the quick response.
>>>>>>
>>>>>> I checked twice. Author is not being fetched.
>>>>>>
>>>>>> Here are thed hibernate logs:
>>>>>>
>>>>>> Scenario 1 : One to One
>>>>>>
>>>>>>
>>>>>>
>>>>>> Query bkquery = session.createQuery("FROM Book");
>>>>>>
>>>>>> List books = bkquery.list();
>>>>>>
>>>>>> System.out.println(books.size());
>>>>>>
>>>>>>
>>>>>>
>>>>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>>>>> book0_.`category`
>>>>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>>> e11_0_,
>>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>>
>>>>>> 3 // getting list size while writer is not yet fetched
>>>>>>
>>>>>>
>>>>>>
>>>>>> Book iBook = (Book)books.get(0);
>>>>>>
>>>>>> Writer author = iBook.getAuthor();
>>>>>>
>>>>>> System.out.println(author.getName());
>>>>>>
>>>>>>
>>>>>>
>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>> e3_2_0_,
>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>> where
>>>>>> writer0_.e_id=?
>>>>>>
>>>>>> JRR Tolkien //fetching the name of the writer for which the previous
>>>>>> query
>>>>>> was executed.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Scenario 2 : One to One
>>>>>>
>>>>>>
>>>>>>
>>>>>> Query otwquery = session.createQuery("From
>>>>>> OneTimeWonder");
>>>>>>
>>>>>> List onetimeWonders = otwquery.list();
>>>>>>
>>>>>> System.out.println(onetimeWonders.size());
>>>>>>
>>>>>>
>>>>>>
>>>>>> //All information queried while getting the size of the list
>>>>>>
>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>>> e3_1_0_,
>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>> library0_.e_id=?
>>>>>>
>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>> e3_2_0_,
>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>> where
>>>>>> writer0_.e_id=?
>>>>>>
>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>> e3_2_0_,
>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>> where
>>>>>> writer0_.e_id=?
>>>>>>
>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>>> e3_1_0_,
>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>> library0_.e_id=?
>>>>>>
>>>>>> Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version
>>>>>> as
>>>>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder`
>>>>>> onetimewon0_
>>>>>>
>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>> e3_5_0_,
>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>> `author`
>>>>>> author0_ where author0_.theBook=?
>>>>>>
>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>> e3_5_0_,
>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>> `author`
>>>>>> author0_ where author0_.theBook=?
>>>>>>
>>>>>> 2 //All information queried while getting the size of the list
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> When I try to get the size I see that all the info is fetched at
>>>>>> once.
>>>>>>
>>>>>> Please let me know if I am missing something here.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Phaneesh
>>>>>>
>>>>>>
>>>>>>
>>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>>> news:4888580F.9030401@elver.org...
>>>>>>> Hi Phaneesh,
>>>>>>> Can you check to be sure that the Author is not accidently already
>>>>>>> read
>>>>>>> into the session?
>>>>>>> See here for how to set hibernate logging which will show this:
>>>>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>>>>
>>>>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is now
>>>>>>> done
>>>>>>> there.
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Phaneesh Nagaraja wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I am trying to use the proxying to improve the performance. I am
>>>>>>>> currently using teneo 1.0.
>>>>>>>> I tried two different scenarios in the library example;
>>>>>>>> Scenario 1:
>>>>>>>> Book -> Writer which is a Many-To-One relationship is getting
>>>>>>>> proxied.
>>>>>>>>
>>>>>>>> Scenario 2:
>>>>>>>> But OneTimeWonder -> Author which is a One-To-One relationship is
>>>>>>>> not
>>>>>>>> getting proxied.
>>>>>>>>
>>>>>>>> I have attached both ecore and the mapping file that is getting
>>>>>>>> generated. Please help me out in understanding why proxying is not
>>>>>>>> working in case of scenario 2.
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Phaneesh
>>>>>>> --
>>>>>>>
>>>>>>> With Regards, Martin Taal
>>>>>>>
>>>>>>> Springsite/Elver.org
>>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>>> The Netherlands
>>>>>>> Cell: +31 (0)6 288 48 943
>>>>>>> Tel: +31 (0)84 420 2397
>>>>>>> Fax: +31 (0)84 225 9307
>>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>>> Web: www.springsite.com - www.elver.org
>>>>> --
>>>>>
>>>>> With Regards, Martin Taal
>>>>>
>>>>> Springsite/Elver.org
>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>> The Netherlands
>>>>> Cell: +31 (0)6 288 48 943
>>>>> Tel: +31 (0)84 420 2397
>>>>> Fax: +31 (0)84 225 9307
>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>> Web: www.springsite.com - www.elver.org
>>>>
>>>
>>> --
>>>
>>> With Regards, Martin Taal
>>>
>>> Springsite/Elver.org
>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>> The Netherlands
>>> Cell: +31 (0)6 288 48 943
>>> Tel: +31 (0)84 420 2397
>>> Fax: +31 (0)84 225 9307
>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>> Web: www.springsite.com - www.elver.org
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org
>


------------------------------------------------------------ --------------------


> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
> 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>
> <hibernate-mapping auto-import="false">
> <class name="org.eclipse.emf.teneo.samples.issues.bz242995.impl.BookImpl "
> entity-name="Book" abstract="false" lazy="true" discriminator-value="Book"
> table="`book`" proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Book">
> <meta attribute="eclassName">Book</meta>
> <meta
> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="title" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`title`"/>
> </property>
> <property name="pages" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`pages`"/>
> </property>
> <property name="category" lazy="false" not-null="false" insert="true"
> update="true" unique="false">
> <column not-null="false" unique="false" name="`category`"/>
> <type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType" >
> <param
> name="enumClass">org.eclipse.emf.teneo.samples.issues.bz242995.BookCategory </param>
> </type>
> </property>
> <many-to-one name="author" entity-name="Writer"
> cascade="merge,persist,save-update,lock,refresh" foreign-key="book_author"
> lazy="proxy" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`book_author_e_id`"/>
> </many-to-one>
> </class>
> <class
> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.LibraryIm pl "
> entity-name="Library" abstract="false" lazy="true"
> discriminator-value="Library" table="`library`"
> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Library ">
> <meta attribute="eclassName">Library</meta>
> <meta
> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <list name="writers" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="library_writers">
> <column name="`library_writers_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`library_writers_idx`"/>
> <one-to-many entity-name="Writer"/>
> </list>
> <list name="books" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="library_books">
> <column name="`library_books_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`library_books_idx`"/>
> <one-to-many entity-name="Book"/>
> </list>
> </class>
> <class
> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.WriterImp l "
> entity-name="Writer" abstract="false" lazy="true"
> discriminator-value="Writer" table="`writer`"
> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Writer ">
> <meta attribute="eclassName">Writer</meta>
> <meta
> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <list name="books" lazy="true"
> cascade="merge,persist,save-update,lock,refresh">
> <key update="true">
> <column name="`book_author_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`writer_books_idx`"/>
> <one-to-many entity-name="Book"/>
> </list>
> </class>
> <class
> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.OneTimeWo nderImpl "
> entity-name="OneTimeWonder" abstract="false" lazy="true"
> discriminator-value="OneTimeWonder" table="`onetimewonder`"
> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.OneTimeWonder ">
> <meta attribute="eclassName">OneTimeWonder</meta>
> <meta
> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
> <id name="id" type="long" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="foreign">
> <param name="property">theAuthor</param>
> </generator>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="Name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <one-to-one name="theAuthor" entity-name="Author"
> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
> constrained="true"/>
> </class>
> <class
> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.AuthorImp l "
> entity-name="Author" abstract="false" lazy="true"
> discriminator-value="Author" table="`author`"
> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Author ">
> <meta attribute="eclassName">Author</meta>
> <meta
> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
> <id name="id" type="long" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="Name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <one-to-one name="theBook" entity-name="OneTimeWonder"
> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
> </class>
> </hibernate-mapping>


------------------------------------------------------------ --------------------


> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bz242995"
> nsURI="http:///org/eclipse/example/library.ecore"
> nsPrefix="org.eclipse.example.library">
> <eClassifiers xsi:type="ecore:EClass" name="Book">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="title"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="pages"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
> defaultValueLiteral="100"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="category"
> eType="#//BookCategory"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="author"
> lowerBound="1"
> eType="#//Writer" eOpposite="#//Writer/books"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Library">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="writers"
> upperBound="-1"
> eType="#//Writer" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
> upperBound="-1"
> eType="#//Book" containment="true"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Writer">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
> upperBound="-1"
> eType="#//Book" eOpposite="#//Book/author"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EEnum" name="BookCategory">
> <eLiterals name="Mystery"/>
> <eLiterals name="ScienceFiction" value="1"/>
> <eLiterals name="Biography" value="2"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="OneTimeWonder">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="theAuthor"
> lowerBound="1"
> eType="#//Author" eOpposite="#//Author/theBook">
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@PrimaryKeyJoinColumn"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Id"/>
> </eAnnotations>
> </eStructuralFeatures>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Author">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="theBook"
> lowerBound="1"
> eType="#//OneTimeWonder" eOpposite="#//OneTimeWonder/theAuthor"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Id&#xA;@GeneratedValue"/>
> </eAnnotations>
> </eStructuralFeatures>
> </eClassifiers>
> </ecore:EPackage>
>
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421737 is a reply to message #421736] Tue, 12 August 2008 18:58 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
The code is in cvs. I will do a new build in about an hour.

gr. Martin

Phaneesh Nagaraja wrote:
> Hi Martin,
>
> Can you send me a patch of the changes that you did to solve the problem? If
> code is already commited in cvs I will update the source I have.
>
> Thanks
> Phaneesh
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:g76tim$75g$1@build.eclipse.org...
>> Hi Phaneesh,
>> Here it is together with the generated hbm (I added your example to the
>> Teneo test cases).
>>
>> Note that the bugfix will be available in a few days. I want to solve some
>> more bugzillas before
>> doing a new build.
>>
>> gr. Martin
>>
>> Phaneesh Nagaraja wrote:
>>> Hi martin,
>>>
>>> Can you send me the updated ecore>
>>>
>>> Thanks
>>> Phaneesh
>>>
>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>> news:g74v64$t97$1@build.eclipse.org...
>>>> Hi Phaneesh,
>>>> I found the underlying cause of this not being handled as a proxy. The
>>>> main thing is that Teneo did not map the relation correctly because it
>>>> did
>>>> not really treat it as a primarykeyjoincolumn. One reason was that there
>>>> was no explicit id defined on the model. Teneo adds a synthetic id but
>>>> this id does not support the foreign id-generator strategy. I won't
>>>> change
>>>> this as using synthetic id's is not recommended.
>>>> So I added explicit id's to your model. The foreign generator was used
>>>> correctly. Then I noticed that the mapping was not correct. For the case
>>>> of a oto mapping with pk join columns there should be a oto on both
>>>> sides.
>>>> Teneo was placing a mto on one side. I needed to change the mapping
>>>> logic.
>>>> With the fix the one-to-one does not need to be specified, only the
>>>> @PrimaryKeyJoinColumn on one side. See the attached ecore. Also the
>>>> author
>>>> was proxied correctly. Note that the proxy gets resolved when the test
>>>> does otw.getAuthor() because the getAuthor() call does author.eIsProxy()
>>>> which resolves the proxy.
>>>>
>>>> Here is the mapping, attached you can find the updated ecore. This fix
>>>> will be in the next build of Teneo (one of coming days).
>>>>
>>>> gr. Martin
>>>> <class name="library.impl.OneTimeWonderImpl" entity-name="OneTimeWonder"
>>>> abstract="false" lazy="true" discriminator-value="OneTimeWonder"
>>>> table="`onetimewonder`" proxy="library.OneTimeWonder">
>>>> <meta attribute="eclassName">OneTimeWonder</meta>
>>>> <meta
>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>> <id name="id" type="long" unsaved-value="0">
>>>> <column not-null="true" unique="false" name="`id`"/>
>>>> <generator class="foreign">
>>>> <param name="property">theAuthor</param>
>>>> </generator>
>>>> </id>
>>>> <discriminator column="`dtype`" type="string"/>
>>>> <version name="e_version" column="e_version"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>> <meta attribute="syntheticVersion">true</meta>
>>>> </version>
>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>> not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`name`"/>
>>>> </property>
>>>> <one-to-one name="theAuthor" entity-name="Author"
>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>>>> constrained="true"/>
>>>> </class>
>>>> <class name="library.impl.AuthorImpl" entity-name="Author"
>>>> abstract="false" lazy="true" discriminator-value="Author"
>>>> table="`author`"
>>>> proxy="library.Author">
>>>> <meta attribute="eclassName">Author</meta>
>>>> <meta
>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>> <id name="id" type="long" unsaved-value="0">
>>>> <column not-null="true" unique="false" name="`id`"/>
>>>> <generator class="native"/>
>>>> </id>
>>>> <discriminator column="`dtype`" type="string"/>
>>>> <version name="e_version" column="e_version"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>> <meta attribute="syntheticVersion">true</meta>
>>>> </version>
>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>> not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`name`"/>
>>>> </property>
>>>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>>>> </class>
>>>>
>>>>
>>>> Phaneesh Nagaraja wrote:
>>>>> For scenario 1: Many to one Relationship
>>>>> Java code block:
>>>>> Query bkquery = session.createQuery("FROM Book");
>>>>>
>>>>> List books = bkquery.list();
>>>>>
>>>>> //Get the size of the fetched book
>>>>>
>>>>> System.out.println(books.size());
>>>>>
>>>>>
>>>>>
>>>>> Output:
>>>>>
>>>>> 3 //No of books in the books table
>>>>>
>>>>>
>>>>>
>>>>> SQL Query fired:
>>>>>
>>>>>
>>>>>
>>>>> select book0_.e_id as e1_0_, book0_.e_version as e3_0_, book0_.`title`
>>>>> as
>>>>> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as
>>>>> category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>> e11_0_,
>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>
>>>>>
>>>>>
>>>>> In the above query the writer table is not accessed as we have yet to
>>>>> access any writer object.
>>>>>
>>>>>
>>>>>
>>>>> When I fetch the writer object object:
>>>>>
>>>>>
>>>>>
>>>>> Java Code block:
>>>>>
>>>>> Book iBook = (Book)books.get(0);
>>>>>
>>>>> Writer author = iBook.getAuthor();
>>>>>
>>>>> System.out.println(author.getName());
>>>>>
>>>>>
>>>>>
>>>>> SQL query fired:
>>>>>
>>>>>
>>>>>
>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>>> writer0_.e_id=?
>>>>>
>>>>>
>>>>>
>>>>> In the above query, the writer table is accessed when I fetch the
>>>>> author
>>>>> of the book which is an Writer object.
>>>>>
>>>>>
>>>>>
>>>>> Output:
>>>>>
>>>>> JRR Tolkien //Name of the author
>>>>>
>>>>>
>>>>>
>>>>> For Scenario 2: One to One relationship
>>>>>
>>>>>
>>>>>
>>>>> Java Code Block:
>>>>>
>>>>> Query otwquery = session.createQuery("From
>>>>> OneTimeWonder");
>>>>>
>>>>> List onetimeWonders = otwquery.list();
>>>>>
>>>>> System.out.println(onetimeWonders.size());
>>>>>
>>>>>
>>>>>
>>>>> SQL query fired:
>>>>>
>>>>>
>>>>>
>>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>> library0_.e_id=?
>>>>>
>>>>>
>>>>>
>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>>> writer0_.e_id=?
>>>>>
>>>>>
>>>>>
>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_ where
>>>>> writer0_.e_id=?
>>>>>
>>>>>
>>>>>
>>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>> library0_.e_id=?
>>>>>
>>>>>
>>>>>
>>>>> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
>>>>> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>>>>
>>>>>
>>>>>
>>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>> `author` author0_ where author0_.theBook=?
>>>>>
>>>>>
>>>>>
>>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>> `author` author0_ where author0_.theBook=?
>>>>>
>>>>>
>>>>>
>>>>> The above set of queries indicate that all the information from writer
>>>>> table, and author table is fetched eventhough I have not accessed the
>>>>> writer or author.
>>>>>
>>>>>
>>>>>
>>>>> Output:
>>>>>
>>>>> 2 //Total records in OneTimeWonder table
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> I have attached the ecore model and junit testcase which would be
>>>>> sufficient to try it out.
>>>>>
>>>>>
>>>>>
>>>>> If you need any more info please let me know.
>>>>>
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>> Phaneesh
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>> news:g6c66e$8dp$1@build.eclipse.org...
>>>>>> Hi Phaneesh,
>>>>>> Getting the list.size() generates a number of queries which I don't
>>>>>> fully understand (the initial
>>>>>> library and writer queries). Can you post the complete testcase?
>>>>>> Let me know if I require anything else than the test case and the
>>>>>> model
>>>>>> to try this myself.
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Phaneesh Nagaraja wrote:
>>>>>>> Hi Martin,
>>>>>>>
>>>>>>> Thanks you for the quick response.
>>>>>>>
>>>>>>> I checked twice. Author is not being fetched.
>>>>>>>
>>>>>>> Here are thed hibernate logs:
>>>>>>>
>>>>>>> Scenario 1 : One to One
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Query bkquery = session.createQuery("FROM Book");
>>>>>>>
>>>>>>> List books = bkquery.list();
>>>>>>>
>>>>>>> System.out.println(books.size());
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>>>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>>>>>> book0_.`category`
>>>>>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>>>> e11_0_,
>>>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>>>
>>>>>>> 3 // getting list size while writer is not yet fetched
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Book iBook = (Book)books.get(0);
>>>>>>>
>>>>>>> Writer author = iBook.getAuthor();
>>>>>>>
>>>>>>> System.out.println(author.getName());
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>> e3_2_0_,
>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>> where
>>>>>>> writer0_.e_id=?
>>>>>>>
>>>>>>> JRR Tolkien //fetching the name of the writer for which the previous
>>>>>>> query
>>>>>>> was executed.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Scenario 2 : One to One
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Query otwquery = session.createQuery("From
>>>>>>> OneTimeWonder");
>>>>>>>
>>>>>>> List onetimeWonders = otwquery.list();
>>>>>>>
>>>>>>> System.out.println(onetimeWonders.size());
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> //All information queried while getting the size of the list
>>>>>>>
>>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>>>> e3_1_0_,
>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>> library0_.e_id=?
>>>>>>>
>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>> e3_2_0_,
>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>> where
>>>>>>> writer0_.e_id=?
>>>>>>>
>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>> e3_2_0_,
>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>> where
>>>>>>> writer0_.e_id=?
>>>>>>>
>>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>>>> e3_1_0_,
>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>> library0_.e_id=?
>>>>>>>
>>>>>>> Hibernate: select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version
>>>>>>> as
>>>>>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder`
>>>>>>> onetimewon0_
>>>>>>>
>>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>>> e3_5_0_,
>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>> `author`
>>>>>>> author0_ where author0_.theBook=?
>>>>>>>
>>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>>> e3_5_0_,
>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>> `author`
>>>>>>> author0_ where author0_.theBook=?
>>>>>>>
>>>>>>> 2 //All information queried while getting the size of the list
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> When I try to get the size I see that all the info is fetched at
>>>>>>> once.
>>>>>>>
>>>>>>> Please let me know if I am missing something here.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Phaneesh
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>>>> news:4888580F.9030401@elver.org...
>>>>>>>> Hi Phaneesh,
>>>>>>>> Can you check to be sure that the Author is not accidently already
>>>>>>>> read
>>>>>>>> into the session?
>>>>>>>> See here for how to set hibernate logging which will show this:
>>>>>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>>>>>
>>>>>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is now
>>>>>>>> done
>>>>>>>> there.
>>>>>>>>
>>>>>>>> gr. Martin
>>>>>>>>
>>>>>>>> Phaneesh Nagaraja wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I am trying to use the proxying to improve the performance. I am
>>>>>>>>> currently using teneo 1.0.
>>>>>>>>> I tried two different scenarios in the library example;
>>>>>>>>> Scenario 1:
>>>>>>>>> Book -> Writer which is a Many-To-One relationship is getting
>>>>>>>>> proxied.
>>>>>>>>>
>>>>>>>>> Scenario 2:
>>>>>>>>> But OneTimeWonder -> Author which is a One-To-One relationship is
>>>>>>>>> not
>>>>>>>>> getting proxied.
>>>>>>>>>
>>>>>>>>> I have attached both ecore and the mapping file that is getting
>>>>>>>>> generated. Please help me out in understanding why proxying is not
>>>>>>>>> working in case of scenario 2.
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> Phaneesh
>>>>>>>> --
>>>>>>>>
>>>>>>>> With Regards, Martin Taal
>>>>>>>>
>>>>>>>> Springsite/Elver.org
>>>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>>>> The Netherlands
>>>>>>>> Cell: +31 (0)6 288 48 943
>>>>>>>> Tel: +31 (0)84 420 2397
>>>>>>>> Fax: +31 (0)84 225 9307
>>>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>>>> Web: www.springsite.com - www.elver.org
>>>>>> --
>>>>>>
>>>>>> With Regards, Martin Taal
>>>>>>
>>>>>> Springsite/Elver.org
>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>> The Netherlands
>>>>>> Cell: +31 (0)6 288 48 943
>>>>>> Tel: +31 (0)84 420 2397
>>>>>> Fax: +31 (0)84 225 9307
>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>> Web: www.springsite.com - www.elver.org
>>>> --
>>>>
>>>> With Regards, Martin Taal
>>>>
>>>> Springsite/Elver.org
>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>> The Netherlands
>>>> Cell: +31 (0)6 288 48 943
>>>> Tel: +31 (0)84 420 2397
>>>> Fax: +31 (0)84 225 9307
>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>> Web: www.springsite.com - www.elver.org
>>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> Cell: +31 (0)6 288 48 943
>> Tel: +31 (0)84 420 2397
>> Fax: +31 (0)84 225 9307
>> Mail: mtaal@springsite.com - mtaal@elver.org
>> Web: www.springsite.com - www.elver.org
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
>> 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>>
>> <hibernate-mapping auto-import="false">
>> <class name="org.eclipse.emf.teneo.samples.issues.bz242995.impl.BookImpl "
>> entity-name="Book" abstract="false" lazy="true" discriminator-value="Book"
>> table="`book`" proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Book">
>> <meta attribute="eclassName">Book</meta>
>> <meta
>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>> <id type="long" name="e_id" column="e_id"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>> <meta attribute="syntheticId">true</meta>
>> <generator class="native"/>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="title" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`title`"/>
>> </property>
>> <property name="pages" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`pages`"/>
>> </property>
>> <property name="category" lazy="false" not-null="false" insert="true"
>> update="true" unique="false">
>> <column not-null="false" unique="false" name="`category`"/>
>> <type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType" >
>> <param
>> name="enumClass">org.eclipse.emf.teneo.samples.issues.bz242995.BookCategory </param>
>> </type>
>> </property>
>> <many-to-one name="author" entity-name="Writer"
>> cascade="merge,persist,save-update,lock,refresh" foreign-key="book_author"
>> lazy="proxy" insert="false" update="false" not-null="false">
>> <column not-null="false" unique="false" name="`book_author_e_id`"/>
>> </many-to-one>
>> </class>
>> <class
>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.LibraryIm pl "
>> entity-name="Library" abstract="false" lazy="true"
>> discriminator-value="Library" table="`library`"
>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Library ">
>> <meta attribute="eclassName">Library</meta>
>> <meta
>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>> <id type="long" name="e_id" column="e_id"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>> <meta attribute="syntheticId">true</meta>
>> <generator class="native"/>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <list name="writers" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="library_writers">
>> <column name="`library_writers_e_id`" not-null="false" unique="false"/>
>> </key>
>> <list-index column="`library_writers_idx`"/>
>> <one-to-many entity-name="Writer"/>
>> </list>
>> <list name="books" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="library_books">
>> <column name="`library_books_e_id`" not-null="false" unique="false"/>
>> </key>
>> <list-index column="`library_books_idx`"/>
>> <one-to-many entity-name="Book"/>
>> </list>
>> </class>
>> <class
>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.WriterImp l "
>> entity-name="Writer" abstract="false" lazy="true"
>> discriminator-value="Writer" table="`writer`"
>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Writer ">
>> <meta attribute="eclassName">Writer</meta>
>> <meta
>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>> <id type="long" name="e_id" column="e_id"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>> <meta attribute="syntheticId">true</meta>
>> <generator class="native"/>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <list name="books" lazy="true"
>> cascade="merge,persist,save-update,lock,refresh">
>> <key update="true">
>> <column name="`book_author_e_id`" not-null="false" unique="false"/>
>> </key>
>> <list-index column="`writer_books_idx`"/>
>> <one-to-many entity-name="Book"/>
>> </list>
>> </class>
>> <class
>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.OneTimeWo nderImpl "
>> entity-name="OneTimeWonder" abstract="false" lazy="true"
>> discriminator-value="OneTimeWonder" table="`onetimewonder`"
>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.OneTimeWonder ">
>> <meta attribute="eclassName">OneTimeWonder</meta>
>> <meta
>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>> <id name="id" type="long" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="foreign">
>> <param name="property">theAuthor</param>
>> </generator>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="Name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <one-to-one name="theAuthor" entity-name="Author"
>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>> constrained="true"/>
>> </class>
>> <class
>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.AuthorImp l "
>> entity-name="Author" abstract="false" lazy="true"
>> discriminator-value="Author" table="`author`"
>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Author ">
>> <meta attribute="eclassName">Author</meta>
>> <meta
>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>> <id name="id" type="long" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="native"/>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="Name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>> </class>
>> </hibernate-mapping>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ecore:EPackage xmi:version="2.0"
>> xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bz242995"
>> nsURI="http:///org/eclipse/example/library.ecore"
>> nsPrefix="org.eclipse.example.library">
>> <eClassifiers xsi:type="ecore:EClass" name="Book">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="title"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="pages"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
>> defaultValueLiteral="100"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="category"
>> eType="#//BookCategory"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="author"
>> lowerBound="1"
>> eType="#//Writer" eOpposite="#//Writer/books"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Library">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="writers"
>> upperBound="-1"
>> eType="#//Writer" containment="true"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
>> upperBound="-1"
>> eType="#//Book" containment="true"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Writer">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
>> upperBound="-1"
>> eType="#//Book" eOpposite="#//Book/author"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EEnum" name="BookCategory">
>> <eLiterals name="Mystery"/>
>> <eLiterals name="ScienceFiction" value="1"/>
>> <eLiterals name="Biography" value="2"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="OneTimeWonder">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="theAuthor"
>> lowerBound="1"
>> eType="#//Author" eOpposite="#//Author/theBook">
>> <eAnnotations source="teneo.jpa">
>> <details key="value" value="@PrimaryKeyJoinColumn"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
>> <eAnnotations source="teneo.jpa">
>> <details key="value" value="@Id"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Author">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="theBook"
>> lowerBound="1"
>> eType="#//OneTimeWonder" eOpposite="#//OneTimeWonder/theAuthor"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
>> <eAnnotations source="teneo.jpa">
>> <details key="value" value="@Id&#xA;@GeneratedValue"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> </eClassifiers>
>> </ecore:EPackage>
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421741 is a reply to message #421737] Tue, 12 August 2008 21:18 Go to previous messageGo to next message
Phaneesh Nagaraja is currently offline Phaneesh NagarajaFriend
Messages: 24
Registered: July 2009
Junior Member
Hi Martin,

I tried the latest Teneo build: M200808121548.
The one-to-one relationship is still not getting proxied. Can you please
confirm whether I need to do any model change to enable proxying?
I have attached my library ecore and hibernate mapping xml that is getting
generated.

Thanks
Phaneesh

"Martin Taal" <mtaal@elver.org> wrote in message
news:g7smhh$nsl$1@build.eclipse.org...
> Hi Phaneesh,
> The code is in cvs. I will do a new build in about an hour.
>
> gr. Martin
>
> Phaneesh Nagaraja wrote:
>> Hi Martin,
>>
>> Can you send me a patch of the changes that you did to solve the problem?
>> If
>> code is already commited in cvs I will update the source I have.
>>
>> Thanks
>> Phaneesh
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:g76tim$75g$1@build.eclipse.org...
>>> Hi Phaneesh,
>>> Here it is together with the generated hbm (I added your example to the
>>> Teneo test cases).
>>>
>>> Note that the bugfix will be available in a few days. I want to solve
>>> some
>>> more bugzillas before
>>> doing a new build.
>>>
>>> gr. Martin
>>>
>>> Phaneesh Nagaraja wrote:
>>>> Hi martin,
>>>>
>>>> Can you send me the updated ecore>
>>>>
>>>> Thanks
>>>> Phaneesh
>>>>
>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>> news:g74v64$t97$1@build.eclipse.org...
>>>>> Hi Phaneesh,
>>>>> I found the underlying cause of this not being handled as a proxy. The
>>>>> main thing is that Teneo did not map the relation correctly because it
>>>>> did
>>>>> not really treat it as a primarykeyjoincolumn. One reason was that
>>>>> there
>>>>> was no explicit id defined on the model. Teneo adds a synthetic id but
>>>>> this id does not support the foreign id-generator strategy. I won't
>>>>> change
>>>>> this as using synthetic id's is not recommended.
>>>>> So I added explicit id's to your model. The foreign generator was used
>>>>> correctly. Then I noticed that the mapping was not correct. For the
>>>>> case
>>>>> of a oto mapping with pk join columns there should be a oto on both
>>>>> sides.
>>>>> Teneo was placing a mto on one side. I needed to change the mapping
>>>>> logic.
>>>>> With the fix the one-to-one does not need to be specified, only the
>>>>> @PrimaryKeyJoinColumn on one side. See the attached ecore. Also the
>>>>> author
>>>>> was proxied correctly. Note that the proxy gets resolved when the test
>>>>> does otw.getAuthor() because the getAuthor() call does
>>>>> author.eIsProxy()
>>>>> which resolves the proxy.
>>>>>
>>>>> Here is the mapping, attached you can find the updated ecore. This fix
>>>>> will be in the next build of Teneo (one of coming days).
>>>>>
>>>>> gr. Martin
>>>>> <class name="library.impl.OneTimeWonderImpl"
>>>>> entity-name="OneTimeWonder"
>>>>> abstract="false" lazy="true" discriminator-value="OneTimeWonder"
>>>>> table="`onetimewonder`" proxy="library.OneTimeWonder">
>>>>> <meta attribute="eclassName">OneTimeWonder</meta>
>>>>> <meta
>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>> <id name="id" type="long" unsaved-value="0">
>>>>> <column not-null="true" unique="false" name="`id`"/>
>>>>> <generator class="foreign">
>>>>> <param name="property">theAuthor</param>
>>>>> </generator>
>>>>> </id>
>>>>> <discriminator column="`dtype`" type="string"/>
>>>>> <version name="e_version" column="e_version"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>> </version>
>>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>> </property>
>>>>> <one-to-one name="theAuthor" entity-name="Author"
>>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>>>>> constrained="true"/>
>>>>> </class>
>>>>> <class name="library.impl.AuthorImpl" entity-name="Author"
>>>>> abstract="false" lazy="true" discriminator-value="Author"
>>>>> table="`author`"
>>>>> proxy="library.Author">
>>>>> <meta attribute="eclassName">Author</meta>
>>>>> <meta
>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>> <id name="id" type="long" unsaved-value="0">
>>>>> <column not-null="true" unique="false" name="`id`"/>
>>>>> <generator class="native"/>
>>>>> </id>
>>>>> <discriminator column="`dtype`" type="string"/>
>>>>> <version name="e_version" column="e_version"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>> </version>
>>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>> </property>
>>>>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>>>>> </class>
>>>>>
>>>>>
>>>>> Phaneesh Nagaraja wrote:
>>>>>> For scenario 1: Many to one Relationship
>>>>>> Java code block:
>>>>>> Query bkquery = session.createQuery("FROM Book");
>>>>>>
>>>>>> List books = bkquery.list();
>>>>>>
>>>>>> //Get the size of the fetched book
>>>>>>
>>>>>> System.out.println(books.size());
>>>>>>
>>>>>>
>>>>>>
>>>>>> Output:
>>>>>>
>>>>>> 3 //No of books in the books table
>>>>>>
>>>>>>
>>>>>>
>>>>>> SQL Query fired:
>>>>>>
>>>>>>
>>>>>>
>>>>>> select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>>>> book0_.`title`
>>>>>> as
>>>>>> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as
>>>>>> category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>>> e11_0_,
>>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>>
>>>>>>
>>>>>>
>>>>>> In the above query the writer table is not accessed as we have yet to
>>>>>> access any writer object.
>>>>>>
>>>>>>
>>>>>>
>>>>>> When I fetch the writer object object:
>>>>>>
>>>>>>
>>>>>>
>>>>>> Java Code block:
>>>>>>
>>>>>> Book iBook = (Book)books.get(0);
>>>>>>
>>>>>> Writer author = iBook.getAuthor();
>>>>>>
>>>>>> System.out.println(author.getName());
>>>>>>
>>>>>>
>>>>>>
>>>>>> SQL query fired:
>>>>>>
>>>>>>
>>>>>>
>>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>> where
>>>>>> writer0_.e_id=?
>>>>>>
>>>>>>
>>>>>>
>>>>>> In the above query, the writer table is accessed when I fetch the
>>>>>> author
>>>>>> of the book which is an Writer object.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Output:
>>>>>>
>>>>>> JRR Tolkien //Name of the author
>>>>>>
>>>>>>
>>>>>>
>>>>>> For Scenario 2: One to One relationship
>>>>>>
>>>>>>
>>>>>>
>>>>>> Java Code Block:
>>>>>>
>>>>>> Query otwquery = session.createQuery("From
>>>>>> OneTimeWonder");
>>>>>>
>>>>>> List onetimeWonders = otwquery.list();
>>>>>>
>>>>>> System.out.println(onetimeWonders.size());
>>>>>>
>>>>>>
>>>>>>
>>>>>> SQL query fired:
>>>>>>
>>>>>>
>>>>>>
>>>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>> library0_.e_id=?
>>>>>>
>>>>>>
>>>>>>
>>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>> where
>>>>>> writer0_.e_id=?
>>>>>>
>>>>>>
>>>>>>
>>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>> where
>>>>>> writer0_.e_id=?
>>>>>>
>>>>>>
>>>>>>
>>>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>> library0_.e_id=?
>>>>>>
>>>>>>
>>>>>>
>>>>>> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
>>>>>> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>>>>>
>>>>>>
>>>>>>
>>>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>> `author` author0_ where author0_.theBook=?
>>>>>>
>>>>>>
>>>>>>
>>>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>> `author` author0_ where author0_.theBook=?
>>>>>>
>>>>>>
>>>>>>
>>>>>> The above set of queries indicate that all the information from
>>>>>> writer
>>>>>> table, and author table is fetched eventhough I have not accessed the
>>>>>> writer or author.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Output:
>>>>>>
>>>>>> 2 //Total records in OneTimeWonder table
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> I have attached the ecore model and junit testcase which would be
>>>>>> sufficient to try it out.
>>>>>>
>>>>>>
>>>>>>
>>>>>> If you need any more info please let me know.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Phaneesh
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>>> news:g6c66e$8dp$1@build.eclipse.org...
>>>>>>> Hi Phaneesh,
>>>>>>> Getting the list.size() generates a number of queries which I don't
>>>>>>> fully understand (the initial
>>>>>>> library and writer queries). Can you post the complete testcase?
>>>>>>> Let me know if I require anything else than the test case and the
>>>>>>> model
>>>>>>> to try this myself.
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Phaneesh Nagaraja wrote:
>>>>>>>> Hi Martin,
>>>>>>>>
>>>>>>>> Thanks you for the quick response.
>>>>>>>>
>>>>>>>> I checked twice. Author is not being fetched.
>>>>>>>>
>>>>>>>> Here are thed hibernate logs:
>>>>>>>>
>>>>>>>> Scenario 1 : One to One
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Query bkquery = session.createQuery("FROM Book");
>>>>>>>>
>>>>>>>> List books = bkquery.list();
>>>>>>>>
>>>>>>>> System.out.println(books.size());
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>>>>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>>>>>>> book0_.`category`
>>>>>>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>>>>> e11_0_,
>>>>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>>>>
>>>>>>>> 3 // getting list size while writer is not yet fetched
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Book iBook = (Book)books.get(0);
>>>>>>>>
>>>>>>>> Writer author = iBook.getAuthor();
>>>>>>>>
>>>>>>>> System.out.println(author.getName());
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>>> e3_2_0_,
>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>> where
>>>>>>>> writer0_.e_id=?
>>>>>>>>
>>>>>>>> JRR Tolkien //fetching the name of the writer for which the
>>>>>>>> previous
>>>>>>>> query
>>>>>>>> was executed.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Scenario 2 : One to One
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Query otwquery = session.createQuery("From
>>>>>>>> OneTimeWonder");
>>>>>>>>
>>>>>>>> List onetimeWonders = otwquery.list();
>>>>>>>>
>>>>>>>> System.out.println(onetimeWonders.size());
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> //All information queried while getting the size of the list
>>>>>>>>
>>>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>>>>> e3_1_0_,
>>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>>> library0_.e_id=?
>>>>>>>>
>>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>>> e3_2_0_,
>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>> where
>>>>>>>> writer0_.e_id=?
>>>>>>>>
>>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>>> e3_2_0_,
>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>> where
>>>>>>>> writer0_.e_id=?
>>>>>>>>
>>>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>>>>> e3_1_0_,
>>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>>> library0_.e_id=?
>>>>>>>>
>>>>>>>> Hibernate: select onetimewon0_.e_id as e1_4_,
>>>>>>>> onetimewon0_.e_version
>>>>>>>> as
>>>>>>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder`
>>>>>>>> onetimewon0_
>>>>>>>>
>>>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>>>> e3_5_0_,
>>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>>> `author`
>>>>>>>> author0_ where author0_.theBook=?
>>>>>>>>
>>>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>>>> e3_5_0_,
>>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>>> `author`
>>>>>>>> author0_ where author0_.theBook=?
>>>>>>>>
>>>>>>>> 2 //All information queried while getting the size of the list
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> When I try to get the size I see that all the info is fetched at
>>>>>>>> once.
>>>>>>>>
>>>>>>>> Please let me know if I am missing something here.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Phaneesh
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>>>>> news:4888580F.9030401@elver.org...
>>>>>>>>> Hi Phaneesh,
>>>>>>>>> Can you check to be sure that the Author is not accidently already
>>>>>>>>> read
>>>>>>>>> into the session?
>>>>>>>>> See here for how to set hibernate logging which will show this:
>>>>>>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>>>>>>
>>>>>>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is
>>>>>>>>> now
>>>>>>>>> done
>>>>>>>>> there.
>>>>>>>>>
>>>>>>>>> gr. Martin
>>>>>>>>>
>>>>>>>>> Phaneesh Nagaraja wrote:
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I am trying to use the proxying to improve the performance. I am
>>>>>>>>>> currently using teneo 1.0.
>>>>>>>>>> I tried two different scenarios in the library example;
>>>>>>>>>> Scenario 1:
>>>>>>>>>> Book -> Writer which is a Many-To-One relationship is getting
>>>>>>>>>> proxied.
>>>>>>>>>>
>>>>>>>>>> Scenario 2:
>>>>>>>>>> But OneTimeWonder -> Author which is a One-To-One relationship is
>>>>>>>>>> not
>>>>>>>>>> getting proxied.
>>>>>>>>>>
>>>>>>>>>> I have attached both ecore and the mapping file that is getting
>>>>>>>>>> generated. Please help me out in understanding why proxying is
>>>>>>>>>> not
>>>>>>>>>> working in case of scenario 2.
>>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>>> Phaneesh
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>> With Regards, Martin Taal
>>>>>>>>>
>>>>>>>>> Springsite/Elver.org
>>>>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>>>>> The Netherlands
>>>>>>>>> Cell: +31 (0)6 288 48 943
>>>>>>>>> Tel: +31 (0)84 420 2397
>>>>>>>>> Fax: +31 (0)84 225 9307
>>>>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>>>>> Web: www.springsite.com - www.elver.org
>>>>>>> --
>>>>>>>
>>>>>>> With Regards, Martin Taal
>>>>>>>
>>>>>>> Springsite/Elver.org
>>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>>> The Netherlands
>>>>>>> Cell: +31 (0)6 288 48 943
>>>>>>> Tel: +31 (0)84 420 2397
>>>>>>> Fax: +31 (0)84 225 9307
>>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>>> Web: www.springsite.com - www.elver.org
>>>>> --
>>>>>
>>>>> With Regards, Martin Taal
>>>>>
>>>>> Springsite/Elver.org
>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>> The Netherlands
>>>>> Cell: +31 (0)6 288 48 943
>>>>> Tel: +31 (0)84 420 2397
>>>>> Fax: +31 (0)84 225 9307
>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>> Web: www.springsite.com - www.elver.org
>>>>
>>>
>>> --
>>>
>>> With Regards, Martin Taal
>>>
>>> Springsite/Elver.org
>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>> The Netherlands
>>> Cell: +31 (0)6 288 48 943
>>> Tel: +31 (0)84 420 2397
>>> Fax: +31 (0)84 225 9307
>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>> Web: www.springsite.com - www.elver.org
>>>
>>
>>
>> ------------------------------------------------------------ --------------------
>>
>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
>>> 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>>>
>>> <hibernate-mapping auto-import="false">
>>> <class
>>> name="org.eclipse.emf.teneo.samples.issues.bz242995.impl.BookImpl "
>>> entity-name="Book" abstract="false" lazy="true"
>>> discriminator-value="Book"
>>> table="`book`"
>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Book">
>>> <meta attribute="eclassName">Book</meta>
>>> <meta
>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>> <id type="long" name="e_id" column="e_id"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>> <meta attribute="syntheticId">true</meta>
>>> <generator class="native"/>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="title" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`title`"/>
>>> </property>
>>> <property name="pages" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="int">
>>> <column not-null="false" unique="false" name="`pages`"/>
>>> </property>
>>> <property name="category" lazy="false" not-null="false" insert="true"
>>> update="true" unique="false">
>>> <column not-null="false" unique="false" name="`category`"/>
>>> <type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType" >
>>> <param
>>> name="enumClass">org.eclipse.emf.teneo.samples.issues.bz242995.BookCategory </param>
>>> </type>
>>> </property>
>>> <many-to-one name="author" entity-name="Writer"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> foreign-key="book_author"
>>> lazy="proxy" insert="false" update="false" not-null="false">
>>> <column not-null="false" unique="false" name="`book_author_e_id`"/>
>>> </many-to-one>
>>> </class>
>>> <class
>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.LibraryIm pl "
>>> entity-name="Library" abstract="false" lazy="true"
>>> discriminator-value="Library" table="`library`"
>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Library ">
>>> <meta attribute="eclassName">Library</meta>
>>> <meta
>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>> <id type="long" name="e_id" column="e_id"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>> <meta attribute="syntheticId">true</meta>
>>> <generator class="native"/>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="name" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`name`"/>
>>> </property>
>>> <list name="writers" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="library_writers">
>>> <column name="`library_writers_e_id`" not-null="false" unique="false"/>
>>> </key>
>>> <list-index column="`library_writers_idx`"/>
>>> <one-to-many entity-name="Writer"/>
>>> </list>
>>> <list name="books" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="library_books">
>>> <column name="`library_books_e_id`" not-null="false" unique="false"/>
>>> </key>
>>> <list-index column="`library_books_idx`"/>
>>> <one-to-many entity-name="Book"/>
>>> </list>
>>> </class>
>>> <class
>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.WriterImp l "
>>> entity-name="Writer" abstract="false" lazy="true"
>>> discriminator-value="Writer" table="`writer`"
>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Writer ">
>>> <meta attribute="eclassName">Writer</meta>
>>> <meta
>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>> <id type="long" name="e_id" column="e_id"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>> <meta attribute="syntheticId">true</meta>
>>> <generator class="native"/>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="name" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`name`"/>
>>> </property>
>>> <list name="books" lazy="true"
>>> cascade="merge,persist,save-update,lock,refresh">
>>> <key update="true">
>>> <column name="`book_author_e_id`" not-null="false" unique="false"/>
>>> </key>
>>> <list-index column="`writer_books_idx`"/>
>>> <one-to-many entity-name="Book"/>
>>> </list>
>>> </class>
>>> <class
>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.OneTimeWo nderImpl "
>>> entity-name="OneTimeWonder" abstract="false" lazy="true"
>>> discriminator-value="OneTimeWonder" table="`onetimewonder`"
>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.OneTimeWonder ">
>>> <meta attribute="eclassName">OneTimeWonder</meta>
>>> <meta
>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>> <id name="id" type="long" unsaved-value="0">
>>> <column not-null="true" unique="false" name="`id`"/>
>>> <generator class="foreign">
>>> <param name="property">theAuthor</param>
>>> </generator>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="Name" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`name`"/>
>>> </property>
>>> <one-to-one name="theAuthor" entity-name="Author"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>>> constrained="true"/>
>>> </class>
>>> <class
>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.AuthorImp l "
>>> entity-name="Author" abstract="false" lazy="true"
>>> discriminator-value="Author" table="`author`"
>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Author ">
>>> <meta attribute="eclassName">Author</meta>
>>> <meta
>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>> <id name="id" type="long" unsaved-value="0">
>>> <column not-null="true" unique="false" name="`id`"/>
>>> <generator class="native"/>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="Name" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`name`"/>
>>> </property>
>>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>>> </class>
>>> </hibernate-mapping>
>>
>>
>> ------------------------------------------------------------ --------------------
>>
>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <ecore:EPackage xmi:version="2.0"
>>> xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bz242995"
>>> nsURI="http:///org/eclipse/example/library.ecore"
>>> nsPrefix="org.eclipse.example.library">
>>> <eClassifiers xsi:type="ecore:EClass" name="Book">
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="title"
>>> eType="ecore:EDataType
>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="pages"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
>>> defaultValueLiteral="100"/>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="category"
>>> eType="#//BookCategory"/>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="author"
>>> lowerBound="1"
>>> eType="#//Writer" eOpposite="#//Writer/books"/>
>>> </eClassifiers>
>>> <eClassifiers xsi:type="ecore:EClass" name="Library">
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>> eType="ecore:EDataType
>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="writers"
>>> upperBound="-1"
>>> eType="#//Writer" containment="true"/>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
>>> upperBound="-1"
>>> eType="#//Book" containment="true"/>
>>> </eClassifiers>
>>> <eClassifiers xsi:type="ecore:EClass" name="Writer">
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>> eType="ecore:EDataType
>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
>>> upperBound="-1"
>>> eType="#//Book" eOpposite="#//Book/author"/>
>>> </eClassifiers>
>>> <eClassifiers xsi:type="ecore:EEnum" name="BookCategory">
>>> <eLiterals name="Mystery"/>
>>> <eLiterals name="ScienceFiction" value="1"/>
>>> <eLiterals name="Biography" value="2"/>
>>> </eClassifiers>
>>> <eClassifiers xsi:type="ecore:EClass" name="OneTimeWonder">
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
>>> eType="ecore:EDataType
>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="theAuthor"
>>> lowerBound="1"
>>> eType="#//Author" eOpposite="#//Author/theBook">
>>> <eAnnotations source="teneo.jpa">
>>> <details key="value" value="@PrimaryKeyJoinColumn"/>
>>> </eAnnotations>
>>> </eStructuralFeatures>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
>>> <eAnnotations source="teneo.jpa">
>>> <details key="value" value="@Id"/>
>>> </eAnnotations>
>>> </eStructuralFeatures>
>>> </eClassifiers>
>>> <eClassifiers xsi:type="ecore:EClass" name="Author">
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
>>> eType="ecore:EDataType
>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="theBook"
>>> lowerBound="1"
>>> eType="#//OneTimeWonder" eOpposite="#//OneTimeWonder/theAuthor"/>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
>>> <eAnnotations source="teneo.jpa">
>>> <details key="value" value="@Id&#xA;@GeneratedValue"/>
>>> </eAnnotations>
>>> </eStructuralFeatures>
>>> </eClassifiers>
>>> </ecore:EPackage>
>>>
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org



Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421746 is a reply to message #421741] Tue, 12 August 2008 21:29 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
Can you try this as an annotation on the one-to-one:
@OneToOne(fetch=LAZY)

gr. Martin

Phaneesh Nagaraja wrote:
> Hi Martin,
>
> I tried the latest Teneo build: M200808121548.
> The one-to-one relationship is still not getting proxied. Can you please
> confirm whether I need to do any model change to enable proxying?
> I have attached my library ecore and hibernate mapping xml that is getting
> generated.
>
> Thanks
> Phaneesh
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:g7smhh$nsl$1@build.eclipse.org...
>> Hi Phaneesh,
>> The code is in cvs. I will do a new build in about an hour.
>>
>> gr. Martin
>>
>> Phaneesh Nagaraja wrote:
>>> Hi Martin,
>>>
>>> Can you send me a patch of the changes that you did to solve the problem?
>>> If
>>> code is already commited in cvs I will update the source I have.
>>>
>>> Thanks
>>> Phaneesh
>>>
>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>> news:g76tim$75g$1@build.eclipse.org...
>>>> Hi Phaneesh,
>>>> Here it is together with the generated hbm (I added your example to the
>>>> Teneo test cases).
>>>>
>>>> Note that the bugfix will be available in a few days. I want to solve
>>>> some
>>>> more bugzillas before
>>>> doing a new build.
>>>>
>>>> gr. Martin
>>>>
>>>> Phaneesh Nagaraja wrote:
>>>>> Hi martin,
>>>>>
>>>>> Can you send me the updated ecore>
>>>>>
>>>>> Thanks
>>>>> Phaneesh
>>>>>
>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>> news:g74v64$t97$1@build.eclipse.org...
>>>>>> Hi Phaneesh,
>>>>>> I found the underlying cause of this not being handled as a proxy. The
>>>>>> main thing is that Teneo did not map the relation correctly because it
>>>>>> did
>>>>>> not really treat it as a primarykeyjoincolumn. One reason was that
>>>>>> there
>>>>>> was no explicit id defined on the model. Teneo adds a synthetic id but
>>>>>> this id does not support the foreign id-generator strategy. I won't
>>>>>> change
>>>>>> this as using synthetic id's is not recommended.
>>>>>> So I added explicit id's to your model. The foreign generator was used
>>>>>> correctly. Then I noticed that the mapping was not correct. For the
>>>>>> case
>>>>>> of a oto mapping with pk join columns there should be a oto on both
>>>>>> sides.
>>>>>> Teneo was placing a mto on one side. I needed to change the mapping
>>>>>> logic.
>>>>>> With the fix the one-to-one does not need to be specified, only the
>>>>>> @PrimaryKeyJoinColumn on one side. See the attached ecore. Also the
>>>>>> author
>>>>>> was proxied correctly. Note that the proxy gets resolved when the test
>>>>>> does otw.getAuthor() because the getAuthor() call does
>>>>>> author.eIsProxy()
>>>>>> which resolves the proxy.
>>>>>>
>>>>>> Here is the mapping, attached you can find the updated ecore. This fix
>>>>>> will be in the next build of Teneo (one of coming days).
>>>>>>
>>>>>> gr. Martin
>>>>>> <class name="library.impl.OneTimeWonderImpl"
>>>>>> entity-name="OneTimeWonder"
>>>>>> abstract="false" lazy="true" discriminator-value="OneTimeWonder"
>>>>>> table="`onetimewonder`" proxy="library.OneTimeWonder">
>>>>>> <meta attribute="eclassName">OneTimeWonder</meta>
>>>>>> <meta
>>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>>> <id name="id" type="long" unsaved-value="0">
>>>>>> <column not-null="true" unique="false" name="`id`"/>
>>>>>> <generator class="foreign">
>>>>>> <param name="property">theAuthor</param>
>>>>>> </generator>
>>>>>> </id>
>>>>>> <discriminator column="`dtype`" type="string"/>
>>>>>> <version name="e_version" column="e_version"
>>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>>> </version>
>>>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>>> </property>
>>>>>> <one-to-one name="theAuthor" entity-name="Author"
>>>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>>>>>> constrained="true"/>
>>>>>> </class>
>>>>>> <class name="library.impl.AuthorImpl" entity-name="Author"
>>>>>> abstract="false" lazy="true" discriminator-value="Author"
>>>>>> table="`author`"
>>>>>> proxy="library.Author">
>>>>>> <meta attribute="eclassName">Author</meta>
>>>>>> <meta
>>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>>> <id name="id" type="long" unsaved-value="0">
>>>>>> <column not-null="true" unique="false" name="`id`"/>
>>>>>> <generator class="native"/>
>>>>>> </id>
>>>>>> <discriminator column="`dtype`" type="string"/>
>>>>>> <version name="e_version" column="e_version"
>>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>>> </version>
>>>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>>> </property>
>>>>>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>>>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>>>>>> </class>
>>>>>>
>>>>>>
>>>>>> Phaneesh Nagaraja wrote:
>>>>>>> For scenario 1: Many to one Relationship
>>>>>>> Java code block:
>>>>>>> Query bkquery = session.createQuery("FROM Book");
>>>>>>>
>>>>>>> List books = bkquery.list();
>>>>>>>
>>>>>>> //Get the size of the fetched book
>>>>>>>
>>>>>>> System.out.println(books.size());
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Output:
>>>>>>>
>>>>>>> 3 //No of books in the books table
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> SQL Query fired:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>>>>> book0_.`title`
>>>>>>> as
>>>>>>> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as
>>>>>>> category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>>>> e11_0_,
>>>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> In the above query the writer table is not accessed as we have yet to
>>>>>>> access any writer object.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> When I fetch the writer object object:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Java Code block:
>>>>>>>
>>>>>>> Book iBook = (Book)books.get(0);
>>>>>>>
>>>>>>> Writer author = iBook.getAuthor();
>>>>>>>
>>>>>>> System.out.println(author.getName());
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> SQL query fired:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>> where
>>>>>>> writer0_.e_id=?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> In the above query, the writer table is accessed when I fetch the
>>>>>>> author
>>>>>>> of the book which is an Writer object.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Output:
>>>>>>>
>>>>>>> JRR Tolkien //Name of the author
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> For Scenario 2: One to One relationship
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Java Code Block:
>>>>>>>
>>>>>>> Query otwquery = session.createQuery("From
>>>>>>> OneTimeWonder");
>>>>>>>
>>>>>>> List onetimeWonders = otwquery.list();
>>>>>>>
>>>>>>> System.out.println(onetimeWonders.size());
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> SQL query fired:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>> library0_.e_id=?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>> where
>>>>>>> writer0_.e_id=?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>> where
>>>>>>> writer0_.e_id=?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>> library0_.e_id=?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
>>>>>>> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>> `author` author0_ where author0_.theBook=?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>> `author` author0_ where author0_.theBook=?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> The above set of queries indicate that all the information from
>>>>>>> writer
>>>>>>> table, and author table is fetched eventhough I have not accessed the
>>>>>>> writer or author.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Output:
>>>>>>>
>>>>>>> 2 //Total records in OneTimeWonder table
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I have attached the ecore model and junit testcase which would be
>>>>>>> sufficient to try it out.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> If you need any more info please let me know.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Phaneesh
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>>>> news:g6c66e$8dp$1@build.eclipse.org...
>>>>>>>> Hi Phaneesh,
>>>>>>>> Getting the list.size() generates a number of queries which I don't
>>>>>>>> fully understand (the initial
>>>>>>>> library and writer queries). Can you post the complete testcase?
>>>>>>>> Let me know if I require anything else than the test case and the
>>>>>>>> model
>>>>>>>> to try this myself.
>>>>>>>>
>>>>>>>> gr. Martin
>>>>>>>>
>>>>>>>> Phaneesh Nagaraja wrote:
>>>>>>>>> Hi Martin,
>>>>>>>>>
>>>>>>>>> Thanks you for the quick response.
>>>>>>>>>
>>>>>>>>> I checked twice. Author is not being fetched.
>>>>>>>>>
>>>>>>>>> Here are thed hibernate logs:
>>>>>>>>>
>>>>>>>>> Scenario 1 : One to One
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Query bkquery = session.createQuery("FROM Book");
>>>>>>>>>
>>>>>>>>> List books = bkquery.list();
>>>>>>>>>
>>>>>>>>> System.out.println(books.size());
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>>>>>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>>>>>>>> book0_.`category`
>>>>>>>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>>>>>> e11_0_,
>>>>>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>>>>>
>>>>>>>>> 3 // getting list size while writer is not yet fetched
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Book iBook = (Book)books.get(0);
>>>>>>>>>
>>>>>>>>> Writer author = iBook.getAuthor();
>>>>>>>>>
>>>>>>>>> System.out.println(author.getName());
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>>>> e3_2_0_,
>>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>>> where
>>>>>>>>> writer0_.e_id=?
>>>>>>>>>
>>>>>>>>> JRR Tolkien //fetching the name of the writer for which the
>>>>>>>>> previous
>>>>>>>>> query
>>>>>>>>> was executed.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Scenario 2 : One to One
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Query otwquery = session.createQuery("From
>>>>>>>>> OneTimeWonder");
>>>>>>>>>
>>>>>>>>> List onetimeWonders = otwquery.list();
>>>>>>>>>
>>>>>>>>> System.out.println(onetimeWonders.size());
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> //All information queried while getting the size of the list
>>>>>>>>>
>>>>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>>>>>> e3_1_0_,
>>>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>>>> library0_.e_id=?
>>>>>>>>>
>>>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>>>> e3_2_0_,
>>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>>> where
>>>>>>>>> writer0_.e_id=?
>>>>>>>>>
>>>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>>>> e3_2_0_,
>>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>>> where
>>>>>>>>> writer0_.e_id=?
>>>>>>>>>
>>>>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version as
>>>>>>>>> e3_1_0_,
>>>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>>>> library0_.e_id=?
>>>>>>>>>
>>>>>>>>> Hibernate: select onetimewon0_.e_id as e1_4_,
>>>>>>>>> onetimewon0_.e_version
>>>>>>>>> as
>>>>>>>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder`
>>>>>>>>> onetimewon0_
>>>>>>>>>
>>>>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>>>>> e3_5_0_,
>>>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>>>> `author`
>>>>>>>>> author0_ where author0_.theBook=?
>>>>>>>>>
>>>>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>>>>> e3_5_0_,
>>>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>>>> `author`
>>>>>>>>> author0_ where author0_.theBook=?
>>>>>>>>>
>>>>>>>>> 2 //All information queried while getting the size of the list
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> When I try to get the size I see that all the info is fetched at
>>>>>>>>> once.
>>>>>>>>>
>>>>>>>>> Please let me know if I am missing something here.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>> Phaneesh
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>>>>>> news:4888580F.9030401@elver.org...
>>>>>>>>>> Hi Phaneesh,
>>>>>>>>>> Can you check to be sure that the Author is not accidently already
>>>>>>>>>> read
>>>>>>>>>> into the session?
>>>>>>>>>> See here for how to set hibernate logging which will show this:
>>>>>>>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>>>>>>>
>>>>>>>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is
>>>>>>>>>> now
>>>>>>>>>> done
>>>>>>>>>> there.
>>>>>>>>>>
>>>>>>>>>> gr. Martin
>>>>>>>>>>
>>>>>>>>>> Phaneesh Nagaraja wrote:
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I am trying to use the proxying to improve the performance. I am
>>>>>>>>>>> currently using teneo 1.0.
>>>>>>>>>>> I tried two different scenarios in the library example;
>>>>>>>>>>> Scenario 1:
>>>>>>>>>>> Book -> Writer which is a Many-To-One relationship is getting
>>>>>>>>>>> proxied.
>>>>>>>>>>>
>>>>>>>>>>> Scenario 2:
>>>>>>>>>>> But OneTimeWonder -> Author which is a One-To-One relationship is
>>>>>>>>>>> not
>>>>>>>>>>> getting proxied.
>>>>>>>>>>>
>>>>>>>>>>> I have attached both ecore and the mapping file that is getting
>>>>>>>>>>> generated. Please help me out in understanding why proxying is
>>>>>>>>>>> not
>>>>>>>>>>> working in case of scenario 2.
>>>>>>>>>>>
>>>>>>>>>>> Thanks
>>>>>>>>>>> Phaneesh
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> With Regards, Martin Taal
>>>>>>>>>>
>>>>>>>>>> Springsite/Elver.org
>>>>>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>>>>>> The Netherlands
>>>>>>>>>> Cell: +31 (0)6 288 48 943
>>>>>>>>>> Tel: +31 (0)84 420 2397
>>>>>>>>>> Fax: +31 (0)84 225 9307
>>>>>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>>>>>> Web: www.springsite.com - www.elver.org
>>>>>>>> --
>>>>>>>>
>>>>>>>> With Regards, Martin Taal
>>>>>>>>
>>>>>>>> Springsite/Elver.org
>>>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>>>> The Netherlands
>>>>>>>> Cell: +31 (0)6 288 48 943
>>>>>>>> Tel: +31 (0)84 420 2397
>>>>>>>> Fax: +31 (0)84 225 9307
>>>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>>>> Web: www.springsite.com - www.elver.org
>>>>>> --
>>>>>>
>>>>>> With Regards, Martin Taal
>>>>>>
>>>>>> Springsite/Elver.org
>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>> The Netherlands
>>>>>> Cell: +31 (0)6 288 48 943
>>>>>> Tel: +31 (0)84 420 2397
>>>>>> Fax: +31 (0)84 225 9307
>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>> Web: www.springsite.com - www.elver.org
>>>> --
>>>>
>>>> With Regards, Martin Taal
>>>>
>>>> Springsite/Elver.org
>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>> The Netherlands
>>>> Cell: +31 (0)6 288 48 943
>>>> Tel: +31 (0)84 420 2397
>>>> Fax: +31 (0)84 225 9307
>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>> Web: www.springsite.com - www.elver.org
>>>>
>>>
>>> ------------------------------------------------------------ --------------------
>>>
>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
>>>> 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>>>>
>>>> <hibernate-mapping auto-import="false">
>>>> <class
>>>> name="org.eclipse.emf.teneo.samples.issues.bz242995.impl.BookImpl "
>>>> entity-name="Book" abstract="false" lazy="true"
>>>> discriminator-value="Book"
>>>> table="`book`"
>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Book">
>>>> <meta attribute="eclassName">Book</meta>
>>>> <meta
>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>> <id type="long" name="e_id" column="e_id"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>> <meta attribute="syntheticId">true</meta>
>>>> <generator class="native"/>
>>>> </id>
>>>> <discriminator column="`dtype`" type="string"/>
>>>> <version name="e_version" column="e_version"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>> <meta attribute="syntheticVersion">true</meta>
>>>> </version>
>>>> <property name="title" lazy="false" insert="true" update="true"
>>>> not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`title`"/>
>>>> </property>
>>>> <property name="pages" lazy="false" insert="true" update="true"
>>>> not-null="false" unique="false" type="int">
>>>> <column not-null="false" unique="false" name="`pages`"/>
>>>> </property>
>>>> <property name="category" lazy="false" not-null="false" insert="true"
>>>> update="true" unique="false">
>>>> <column not-null="false" unique="false" name="`category`"/>
>>>> <type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType" >
>>>> <param
>>>> name="enumClass">org.eclipse.emf.teneo.samples.issues.bz242995.BookCategory </param>
>>>> </type>
>>>> </property>
>>>> <many-to-one name="author" entity-name="Writer"
>>>> cascade="merge,persist,save-update,lock,refresh"
>>>> foreign-key="book_author"
>>>> lazy="proxy" insert="false" update="false" not-null="false">
>>>> <column not-null="false" unique="false" name="`book_author_e_id`"/>
>>>> </many-to-one>
>>>> </class>
>>>> <class
>>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.LibraryIm pl "
>>>> entity-name="Library" abstract="false" lazy="true"
>>>> discriminator-value="Library" table="`library`"
>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Library ">
>>>> <meta attribute="eclassName">Library</meta>
>>>> <meta
>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>> <id type="long" name="e_id" column="e_id"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>> <meta attribute="syntheticId">true</meta>
>>>> <generator class="native"/>
>>>> </id>
>>>> <discriminator column="`dtype`" type="string"/>
>>>> <version name="e_version" column="e_version"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>> <meta attribute="syntheticVersion">true</meta>
>>>> </version>
>>>> <property name="name" lazy="false" insert="true" update="true"
>>>> not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`name`"/>
>>>> </property>
>>>> <list name="writers" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true" foreign-key="library_writers">
>>>> <column name="`library_writers_e_id`" not-null="false" unique="false"/>
>>>> </key>
>>>> <list-index column="`library_writers_idx`"/>
>>>> <one-to-many entity-name="Writer"/>
>>>> </list>
>>>> <list name="books" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true" foreign-key="library_books">
>>>> <column name="`library_books_e_id`" not-null="false" unique="false"/>
>>>> </key>
>>>> <list-index column="`library_books_idx`"/>
>>>> <one-to-many entity-name="Book"/>
>>>> </list>
>>>> </class>
>>>> <class
>>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.WriterImp l "
>>>> entity-name="Writer" abstract="false" lazy="true"
>>>> discriminator-value="Writer" table="`writer`"
>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Writer ">
>>>> <meta attribute="eclassName">Writer</meta>
>>>> <meta
>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>> <id type="long" name="e_id" column="e_id"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>> <meta attribute="syntheticId">true</meta>
>>>> <generator class="native"/>
>>>> </id>
>>>> <discriminator column="`dtype`" type="string"/>
>>>> <version name="e_version" column="e_version"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>> <meta attribute="syntheticVersion">true</meta>
>>>> </version>
>>>> <property name="name" lazy="false" insert="true" update="true"
>>>> not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`name`"/>
>>>> </property>
>>>> <list name="books" lazy="true"
>>>> cascade="merge,persist,save-update,lock,refresh">
>>>> <key update="true">
>>>> <column name="`book_author_e_id`" not-null="false" unique="false"/>
>>>> </key>
>>>> <list-index column="`writer_books_idx`"/>
>>>> <one-to-many entity-name="Book"/>
>>>> </list>
>>>> </class>
>>>> <class
>>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.OneTimeWo nderImpl "
>>>> entity-name="OneTimeWonder" abstract="false" lazy="true"
>>>> discriminator-value="OneTimeWonder" table="`onetimewonder`"
>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.OneTimeWonder ">
>>>> <meta attribute="eclassName">OneTimeWonder</meta>
>>>> <meta
>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>> <id name="id" type="long" unsaved-value="0">
>>>> <column not-null="true" unique="false" name="`id`"/>
>>>> <generator class="foreign">
>>>> <param name="property">theAuthor</param>
>>>> </generator>
>>>> </id>
>>>> <discriminator column="`dtype`" type="string"/>
>>>> <version name="e_version" column="e_version"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>> <meta attribute="syntheticVersion">true</meta>
>>>> </version>
>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>> not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`name`"/>
>>>> </property>
>>>> <one-to-one name="theAuthor" entity-name="Author"
>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>>>> constrained="true"/>
>>>> </class>
>>>> <class
>>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.AuthorImp l "
>>>> entity-name="Author" abstract="false" lazy="true"
>>>> discriminator-value="Author" table="`author`"
>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Author ">
>>>> <meta attribute="eclassName">Author</meta>
>>>> <meta
>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>> <id name="id" type="long" unsaved-value="0">
>>>> <column not-null="true" unique="false" name="`id`"/>
>>>> <generator class="native"/>
>>>> </id>
>>>> <discriminator column="`dtype`" type="string"/>
>>>> <version name="e_version" column="e_version"
>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>> <meta attribute="syntheticVersion">true</meta>
>>>> </version>
>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>> not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`name`"/>
>>>> </property>
>>>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>>>> </class>
>>>> </hibernate-mapping>
>>>
>>> ------------------------------------------------------------ --------------------
>>>
>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <ecore:EPackage xmi:version="2.0"
>>>> xmlns:xmi="http://www.omg.org/XMI"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bz242995"
>>>> nsURI="http:///org/eclipse/example/library.ecore"
>>>> nsPrefix="org.eclipse.example.library">
>>>> <eClassifiers xsi:type="ecore:EClass" name="Book">
>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="title"
>>>> eType="ecore:EDataType
>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="pages"
>>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
>>>> defaultValueLiteral="100"/>
>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="category"
>>>> eType="#//BookCategory"/>
>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="author"
>>>> lowerBound="1"
>>>> eType="#//Writer" eOpposite="#//Writer/books"/>
>>>> </eClassifiers>
>>>> <eClassifiers xsi:type="ecore:EClass" name="Library">
>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>>> eType="ecore:EDataType
>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="writers"
>>>> upperBound="-1"
>>>> eType="#//Writer" containment="true"/>
>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
>>>> upperBound="-1"
>>>> eType="#//Book" containment="true"/>
>>>> </eClassifiers>
>>>> <eClassifiers xsi:type="ecore:EClass" name="Writer">
>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>>> eType="ecore:EDataType
>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
>>>> upperBound="-1"
>>>> eType="#//Book" eOpposite="#//Book/author"/>
>>>> </eClassifiers>
>>>> <eClassifiers xsi:type="ecore:EEnum" name="BookCategory">
>>>> <eLiterals name="Mystery"/>
>>>> <eLiterals name="ScienceFiction" value="1"/>
>>>> <eLiterals name="Biography" value="2"/>
>>>> </eClassifiers>
>>>> <eClassifiers xsi:type="ecore:EClass" name="OneTimeWonder">
>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
>>>> eType="ecore:EDataType
>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="theAuthor"
>>>> lowerBound="1"
>>>> eType="#//Author" eOpposite="#//Author/theBook">
>>>> <eAnnotations source="teneo.jpa">
>>>> <details key="value" value="@PrimaryKeyJoinColumn"/>
>>>> </eAnnotations>
>>>> </eStructuralFeatures>
>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
>>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
>>>> <eAnnotations source="teneo.jpa">
>>>> <details key="value" value="@Id"/>
>>>> </eAnnotations>
>>>> </eStructuralFeatures>
>>>> </eClassifiers>
>>>> <eClassifiers xsi:type="ecore:EClass" name="Author">
>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
>>>> eType="ecore:EDataType
>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="theBook"
>>>> lowerBound="1"
>>>> eType="#//OneTimeWonder" eOpposite="#//OneTimeWonder/theAuthor"/>
>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
>>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
>>>> <eAnnotations source="teneo.jpa">
>>>> <details key="value" value="@Id&#xA;@GeneratedValue"/>
>>>> </eAnnotations>
>>>> </eStructuralFeatures>
>>>> </eClassifiers>
>>>> </ecore:EPackage>
>>>>
>>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> Cell: +31 (0)6 288 48 943
>> Tel: +31 (0)84 420 2397
>> Fax: +31 (0)84 225 9307
>> Mail: mtaal@springsite.com - mtaal@elver.org
>> Web: www.springsite.com - www.elver.org
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: CGLib proxy issue in Teneo 1.0 for One-To-One relationship [message #421750 is a reply to message #421746] Tue, 12 August 2008 21:31 Go to previous message
Phaneesh Nagaraja is currently offline Phaneesh NagarajaFriend
Messages: 24
Registered: July 2009
Junior Member
Hi Martin,

That worked!!
Thanks again.

Thanks
Phaneesh

"Martin Taal" <mtaal@elver.org> wrote in message
news:g7svau$qo5$1@build.eclipse.org...
> Hi Phaneesh,
> Can you try this as an annotation on the one-to-one:
> @OneToOne(fetch=LAZY)
>
> gr. Martin
>
> Phaneesh Nagaraja wrote:
>> Hi Martin,
>>
>> I tried the latest Teneo build: M200808121548.
>> The one-to-one relationship is still not getting proxied. Can you please
>> confirm whether I need to do any model change to enable proxying?
>> I have attached my library ecore and hibernate mapping xml that is
>> getting generated.
>>
>> Thanks
>> Phaneesh
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:g7smhh$nsl$1@build.eclipse.org...
>>> Hi Phaneesh,
>>> The code is in cvs. I will do a new build in about an hour.
>>>
>>> gr. Martin
>>>
>>> Phaneesh Nagaraja wrote:
>>>> Hi Martin,
>>>>
>>>> Can you send me a patch of the changes that you did to solve the
>>>> problem? If
>>>> code is already commited in cvs I will update the source I have.
>>>>
>>>> Thanks
>>>> Phaneesh
>>>>
>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>> news:g76tim$75g$1@build.eclipse.org...
>>>>> Hi Phaneesh,
>>>>> Here it is together with the generated hbm (I added your example to
>>>>> the
>>>>> Teneo test cases).
>>>>>
>>>>> Note that the bugfix will be available in a few days. I want to solve
>>>>> some
>>>>> more bugzillas before
>>>>> doing a new build.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Phaneesh Nagaraja wrote:
>>>>>> Hi martin,
>>>>>>
>>>>>> Can you send me the updated ecore>
>>>>>>
>>>>>> Thanks
>>>>>> Phaneesh
>>>>>>
>>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>>> news:g74v64$t97$1@build.eclipse.org...
>>>>>>> Hi Phaneesh,
>>>>>>> I found the underlying cause of this not being handled as a proxy.
>>>>>>> The
>>>>>>> main thing is that Teneo did not map the relation correctly because
>>>>>>> it
>>>>>>> did
>>>>>>> not really treat it as a primarykeyjoincolumn. One reason was that
>>>>>>> there
>>>>>>> was no explicit id defined on the model. Teneo adds a synthetic id
>>>>>>> but
>>>>>>> this id does not support the foreign id-generator strategy. I won't
>>>>>>> change
>>>>>>> this as using synthetic id's is not recommended.
>>>>>>> So I added explicit id's to your model. The foreign generator was
>>>>>>> used
>>>>>>> correctly. Then I noticed that the mapping was not correct. For the
>>>>>>> case
>>>>>>> of a oto mapping with pk join columns there should be a oto on both
>>>>>>> sides.
>>>>>>> Teneo was placing a mto on one side. I needed to change the mapping
>>>>>>> logic.
>>>>>>> With the fix the one-to-one does not need to be specified, only the
>>>>>>> @PrimaryKeyJoinColumn on one side. See the attached ecore. Also the
>>>>>>> author
>>>>>>> was proxied correctly. Note that the proxy gets resolved when the
>>>>>>> test
>>>>>>> does otw.getAuthor() because the getAuthor() call does
>>>>>>> author.eIsProxy()
>>>>>>> which resolves the proxy.
>>>>>>>
>>>>>>> Here is the mapping, attached you can find the updated ecore. This
>>>>>>> fix
>>>>>>> will be in the next build of Teneo (one of coming days).
>>>>>>>
>>>>>>> gr. Martin
>>>>>>> <class name="library.impl.OneTimeWonderImpl"
>>>>>>> entity-name="OneTimeWonder"
>>>>>>> abstract="false" lazy="true" discriminator-value="OneTimeWonder"
>>>>>>> table="`onetimewonder`" proxy="library.OneTimeWonder">
>>>>>>> <meta attribute="eclassName">OneTimeWonder</meta>
>>>>>>> <meta
>>>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>>>> <id name="id" type="long" unsaved-value="0">
>>>>>>> <column not-null="true" unique="false" name="`id`"/>
>>>>>>> <generator class="foreign">
>>>>>>> <param name="property">theAuthor</param>
>>>>>>> </generator>
>>>>>>> </id>
>>>>>>> <discriminator column="`dtype`" type="string"/>
>>>>>>> <version name="e_version" column="e_version"
>>>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>>>> </version>
>>>>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>>>> </property>
>>>>>>> <one-to-one name="theAuthor" entity-name="Author"
>>>>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>>>>>>> constrained="true"/>
>>>>>>> </class>
>>>>>>> <class name="library.impl.AuthorImpl" entity-name="Author"
>>>>>>> abstract="false" lazy="true" discriminator-value="Author"
>>>>>>> table="`author`"
>>>>>>> proxy="library.Author">
>>>>>>> <meta attribute="eclassName">Author</meta>
>>>>>>> <meta
>>>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>>>> <id name="id" type="long" unsaved-value="0">
>>>>>>> <column not-null="true" unique="false" name="`id`"/>
>>>>>>> <generator class="native"/>
>>>>>>> </id>
>>>>>>> <discriminator column="`dtype`" type="string"/>
>>>>>>> <version name="e_version" column="e_version"
>>>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>>>> </version>
>>>>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>>>> </property>
>>>>>>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>>>>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>>>>>>> </class>
>>>>>>>
>>>>>>>
>>>>>>> Phaneesh Nagaraja wrote:
>>>>>>>> For scenario 1: Many to one Relationship
>>>>>>>> Java code block:
>>>>>>>> Query bkquery = session.createQuery("FROM Book");
>>>>>>>>
>>>>>>>> List books = bkquery.list();
>>>>>>>>
>>>>>>>> //Get the size of the fetched book
>>>>>>>>
>>>>>>>> System.out.println(books.size());
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Output:
>>>>>>>>
>>>>>>>> 3 //No of books in the books table
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> SQL Query fired:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> select book0_.e_id as e1_0_, book0_.e_version as e3_0_,
>>>>>>>> book0_.`title`
>>>>>>>> as
>>>>>>>> title4_0_, book0_.`pages` as pages5_0_, book0_.`category` as
>>>>>>>> category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>>>>> e11_0_,
>>>>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> In the above query the writer table is not accessed as we have yet
>>>>>>>> to
>>>>>>>> access any writer object.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> When I fetch the writer object object:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Java Code block:
>>>>>>>>
>>>>>>>> Book iBook = (Book)books.get(0);
>>>>>>>>
>>>>>>>> Writer author = iBook.getAuthor();
>>>>>>>>
>>>>>>>> System.out.println(author.getName());
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> SQL query fired:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>> where
>>>>>>>> writer0_.e_id=?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> In the above query, the writer table is accessed when I fetch the
>>>>>>>> author
>>>>>>>> of the book which is an Writer object.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Output:
>>>>>>>>
>>>>>>>> JRR Tolkien //Name of the author
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> For Scenario 2: One to One relationship
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Java Code Block:
>>>>>>>>
>>>>>>>> Query otwquery = session.createQuery("From
>>>>>>>> OneTimeWonder");
>>>>>>>>
>>>>>>>> List onetimeWonders = otwquery.list();
>>>>>>>>
>>>>>>>> System.out.println(onetimeWonders.size());
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> SQL query fired:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>>> library0_.e_id=?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>> where
>>>>>>>> writer0_.e_id=?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> select writer0_.e_id as e1_2_0_, writer0_.e_version as e3_2_0_,
>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>> where
>>>>>>>> writer0_.e_id=?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> select library0_.e_id as e1_1_0_, library0_.e_version as e3_1_0_,
>>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>>> library0_.e_id=?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> select onetimewon0_.e_id as e1_4_, onetimewon0_.e_version as e3_4_,
>>>>>>>> onetimewon0_.`name` as name4_4_ from `onetimewonder` onetimewon0_
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>>> `author` author0_ where author0_.theBook=?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> select author0_.e_id as e1_5_0_, author0_.e_version as e3_5_0_,
>>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_ from
>>>>>>>> `author` author0_ where author0_.theBook=?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> The above set of queries indicate that all the information from
>>>>>>>> writer
>>>>>>>> table, and author table is fetched eventhough I have not accessed
>>>>>>>> the
>>>>>>>> writer or author.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Output:
>>>>>>>>
>>>>>>>> 2 //Total records in OneTimeWonder table
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I have attached the ecore model and junit testcase which would be
>>>>>>>> sufficient to try it out.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> If you need any more info please let me know.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Phaneesh
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>>>>> news:g6c66e$8dp$1@build.eclipse.org...
>>>>>>>>> Hi Phaneesh,
>>>>>>>>> Getting the list.size() generates a number of queries which I
>>>>>>>>> don't
>>>>>>>>> fully understand (the initial
>>>>>>>>> library and writer queries). Can you post the complete testcase?
>>>>>>>>> Let me know if I require anything else than the test case and the
>>>>>>>>> model
>>>>>>>>> to try this myself.
>>>>>>>>>
>>>>>>>>> gr. Martin
>>>>>>>>>
>>>>>>>>> Phaneesh Nagaraja wrote:
>>>>>>>>>> Hi Martin,
>>>>>>>>>>
>>>>>>>>>> Thanks you for the quick response.
>>>>>>>>>>
>>>>>>>>>> I checked twice. Author is not being fetched.
>>>>>>>>>>
>>>>>>>>>> Here are thed hibernate logs:
>>>>>>>>>>
>>>>>>>>>> Scenario 1 : One to One
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Query bkquery = session.createQuery("FROM
>>>>>>>>>> Book");
>>>>>>>>>>
>>>>>>>>>> List books = bkquery.list();
>>>>>>>>>>
>>>>>>>>>> System.out.println(books.size());
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Hibernate: select book0_.e_id as e1_0_, book0_.e_version as
>>>>>>>>>> e3_0_,
>>>>>>>>>> book0_.`title` as title4_0_, book0_.`pages` as pages5_0_,
>>>>>>>>>> book0_.`category`
>>>>>>>>>> as category6_0_, book0_.`book_author_e_id` as book7_0_,
>>>>>>>>>> book0_.econtainer_class as econtainer10_0_, book0_.e_container as
>>>>>>>>>> e11_0_,
>>>>>>>>>> book0_.e_container_featureid as e12_0_ from `book` book0_
>>>>>>>>>>
>>>>>>>>>> 3 // getting list size while writer is not yet fetched
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Book iBook = (Book)books.get(0);
>>>>>>>>>>
>>>>>>>>>> Writer author = iBook.getAuthor();
>>>>>>>>>>
>>>>>>>>>> System.out.println(author.getName());
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>>>>> e3_2_0_,
>>>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>>>> where
>>>>>>>>>> writer0_.e_id=?
>>>>>>>>>>
>>>>>>>>>> JRR Tolkien //fetching the name of the writer for which the
>>>>>>>>>> previous
>>>>>>>>>> query
>>>>>>>>>> was executed.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Scenario 2 : One to One
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Query otwquery = session.createQuery("From
>>>>>>>>>> OneTimeWonder");
>>>>>>>>>>
>>>>>>>>>> List onetimeWonders = otwquery.list();
>>>>>>>>>>
>>>>>>>>>> System.out.println(onetimeWonders.size());
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> //All information queried while getting the size of the list
>>>>>>>>>>
>>>>>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version
>>>>>>>>>> as
>>>>>>>>>> e3_1_0_,
>>>>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>>>>> library0_.e_id=?
>>>>>>>>>>
>>>>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>>>>> e3_2_0_,
>>>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>>>> where
>>>>>>>>>> writer0_.e_id=?
>>>>>>>>>>
>>>>>>>>>> Hibernate: select writer0_.e_id as e1_2_0_, writer0_.e_version as
>>>>>>>>>> e3_2_0_,
>>>>>>>>>> writer0_.`name` as name4_2_0_, writer0_.econtainer_class as
>>>>>>>>>> econtainer7_2_0_, writer0_.e_container as e8_2_0_,
>>>>>>>>>> writer0_.e_container_featureid as e9_2_0_ from `writer` writer0_
>>>>>>>>>> where
>>>>>>>>>> writer0_.e_id=?
>>>>>>>>>>
>>>>>>>>>> Hibernate: select library0_.e_id as e1_1_0_, library0_.e_version
>>>>>>>>>> as
>>>>>>>>>> e3_1_0_,
>>>>>>>>>> library0_.`name` as name4_1_0_ from `library` library0_ where
>>>>>>>>>> library0_.e_id=?
>>>>>>>>>>
>>>>>>>>>> Hibernate: select onetimewon0_.e_id as e1_4_,
>>>>>>>>>> onetimewon0_.e_version
>>>>>>>>>> as
>>>>>>>>>> e3_4_, onetimewon0_.`name` as name4_4_ from `onetimewonder`
>>>>>>>>>> onetimewon0_
>>>>>>>>>>
>>>>>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>>>>>> e3_5_0_,
>>>>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_
>>>>>>>>>> from
>>>>>>>>>> `author`
>>>>>>>>>> author0_ where author0_.theBook=?
>>>>>>>>>>
>>>>>>>>>> Hibernate: select author0_.e_id as e1_5_0_, author0_.e_version as
>>>>>>>>>> e3_5_0_,
>>>>>>>>>> author0_.`name` as name4_5_0_, author0_.theBook as theBook5_0_
>>>>>>>>>> from
>>>>>>>>>> `author`
>>>>>>>>>> author0_ where author0_.theBook=?
>>>>>>>>>>
>>>>>>>>>> 2 //All information queried while getting the size of the list
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> When I try to get the size I see that all the info is fetched at
>>>>>>>>>> once.
>>>>>>>>>>
>>>>>>>>>> Please let me know if I am missing something here.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>> Phaneesh
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>>>>>>>>> news:4888580F.9030401@elver.org...
>>>>>>>>>>> Hi Phaneesh,
>>>>>>>>>>> Can you check to be sure that the Author is not accidently
>>>>>>>>>>> already
>>>>>>>>>>> read
>>>>>>>>>>> into the session?
>>>>>>>>>>> See here for how to set hibernate logging which will show this:
>>>>>>>>>>> http://www.elver.org/hibernate/troubleshooting.html#runtime
>>>>>>>>>>>
>>>>>>>>>>> btw, I cross-posted to the emf newsgroup as support for Teneo is
>>>>>>>>>>> now
>>>>>>>>>>> done
>>>>>>>>>>> there.
>>>>>>>>>>>
>>>>>>>>>>> gr. Martin
>>>>>>>>>>>
>>>>>>>>>>> Phaneesh Nagaraja wrote:
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I am trying to use the proxying to improve the performance. I
>>>>>>>>>>>> am
>>>>>>>>>>>> currently using teneo 1.0.
>>>>>>>>>>>> I tried two different scenarios in the library example;
>>>>>>>>>>>> Scenario 1:
>>>>>>>>>>>> Book -> Writer which is a Many-To-One relationship is getting
>>>>>>>>>>>> proxied.
>>>>>>>>>>>>
>>>>>>>>>>>> Scenario 2:
>>>>>>>>>>>> But OneTimeWonder -> Author which is a One-To-One relationship
>>>>>>>>>>>> is
>>>>>>>>>>>> not
>>>>>>>>>>>> getting proxied.
>>>>>>>>>>>>
>>>>>>>>>>>> I have attached both ecore and the mapping file that is getting
>>>>>>>>>>>> generated. Please help me out in understanding why proxying is
>>>>>>>>>>>> not
>>>>>>>>>>>> working in case of scenario 2.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks
>>>>>>>>>>>> Phaneesh
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>> With Regards, Martin Taal
>>>>>>>>>>>
>>>>>>>>>>> Springsite/Elver.org
>>>>>>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>>>>>>> The Netherlands
>>>>>>>>>>> Cell: +31 (0)6 288 48 943
>>>>>>>>>>> Tel: +31 (0)84 420 2397
>>>>>>>>>>> Fax: +31 (0)84 225 9307
>>>>>>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>>>>>>> Web: www.springsite.com - www.elver.org
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>> With Regards, Martin Taal
>>>>>>>>>
>>>>>>>>> Springsite/Elver.org
>>>>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>>>>> The Netherlands
>>>>>>>>> Cell: +31 (0)6 288 48 943
>>>>>>>>> Tel: +31 (0)84 420 2397
>>>>>>>>> Fax: +31 (0)84 225 9307
>>>>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>>>>> Web: www.springsite.com - www.elver.org
>>>>>>> --
>>>>>>>
>>>>>>> With Regards, Martin Taal
>>>>>>>
>>>>>>> Springsite/Elver.org
>>>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>>>> The Netherlands
>>>>>>> Cell: +31 (0)6 288 48 943
>>>>>>> Tel: +31 (0)84 420 2397
>>>>>>> Fax: +31 (0)84 225 9307
>>>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>>>> Web: www.springsite.com - www.elver.org
>>>>> --
>>>>>
>>>>> With Regards, Martin Taal
>>>>>
>>>>> Springsite/Elver.org
>>>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>>>> The Netherlands
>>>>> Cell: +31 (0)6 288 48 943
>>>>> Tel: +31 (0)84 420 2397
>>>>> Fax: +31 (0)84 225 9307
>>>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>>>> Web: www.springsite.com - www.elver.org
>>>>>
>>>>
>>>> ------------------------------------------------------------ --------------------
>>>>
>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
>>>>> 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>>>>>
>>>>> <hibernate-mapping auto-import="false">
>>>>> <class
>>>>> name="org.eclipse.emf.teneo.samples.issues.bz242995.impl.BookImpl "
>>>>> entity-name="Book" abstract="false" lazy="true"
>>>>> discriminator-value="Book"
>>>>> table="`book`"
>>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Book">
>>>>> <meta attribute="eclassName">Book</meta>
>>>>> <meta
>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>> <id type="long" name="e_id" column="e_id"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>>> <meta attribute="syntheticId">true</meta>
>>>>> <generator class="native"/>
>>>>> </id>
>>>>> <discriminator column="`dtype`" type="string"/>
>>>>> <version name="e_version" column="e_version"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>> </version>
>>>>> <property name="title" lazy="false" insert="true" update="true"
>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>> <column not-null="false" unique="false" name="`title`"/>
>>>>> </property>
>>>>> <property name="pages" lazy="false" insert="true" update="true"
>>>>> not-null="false" unique="false" type="int">
>>>>> <column not-null="false" unique="false" name="`pages`"/>
>>>>> </property>
>>>>> <property name="category" lazy="false" not-null="false" insert="true"
>>>>> update="true" unique="false">
>>>>> <column not-null="false" unique="false" name="`category`"/>
>>>>> <type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType" >
>>>>> <param
>>>>> name="enumClass">org.eclipse.emf.teneo.samples.issues.bz242995.BookCategory </param>
>>>>> </type>
>>>>> </property>
>>>>> <many-to-one name="author" entity-name="Writer"
>>>>> cascade="merge,persist,save-update,lock,refresh"
>>>>> foreign-key="book_author"
>>>>> lazy="proxy" insert="false" update="false" not-null="false">
>>>>> <column not-null="false" unique="false" name="`book_author_e_id`"/>
>>>>> </many-to-one>
>>>>> </class>
>>>>> <class
>>>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.LibraryIm pl "
>>>>> entity-name="Library" abstract="false" lazy="true"
>>>>> discriminator-value="Library" table="`library`"
>>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Library ">
>>>>> <meta attribute="eclassName">Library</meta>
>>>>> <meta
>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>> <id type="long" name="e_id" column="e_id"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>>> <meta attribute="syntheticId">true</meta>
>>>>> <generator class="native"/>
>>>>> </id>
>>>>> <discriminator column="`dtype`" type="string"/>
>>>>> <version name="e_version" column="e_version"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>> </version>
>>>>> <property name="name" lazy="false" insert="true" update="true"
>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>> </property>
>>>>> <list name="writers" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true" foreign-key="library_writers">
>>>>> <column name="`library_writers_e_id`" not-null="false"
>>>>> unique="false"/>
>>>>> </key>
>>>>> <list-index column="`library_writers_idx`"/>
>>>>> <one-to-many entity-name="Writer"/>
>>>>> </list>
>>>>> <list name="books" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true" foreign-key="library_books">
>>>>> <column name="`library_books_e_id`" not-null="false" unique="false"/>
>>>>> </key>
>>>>> <list-index column="`library_books_idx`"/>
>>>>> <one-to-many entity-name="Book"/>
>>>>> </list>
>>>>> </class>
>>>>> <class
>>>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.WriterImp l "
>>>>> entity-name="Writer" abstract="false" lazy="true"
>>>>> discriminator-value="Writer" table="`writer`"
>>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Writer ">
>>>>> <meta attribute="eclassName">Writer</meta>
>>>>> <meta
>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>> <id type="long" name="e_id" column="e_id"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>>> <meta attribute="syntheticId">true</meta>
>>>>> <generator class="native"/>
>>>>> </id>
>>>>> <discriminator column="`dtype`" type="string"/>
>>>>> <version name="e_version" column="e_version"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>> </version>
>>>>> <property name="name" lazy="false" insert="true" update="true"
>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>> </property>
>>>>> <list name="books" lazy="true"
>>>>> cascade="merge,persist,save-update,lock,refresh">
>>>>> <key update="true">
>>>>> <column name="`book_author_e_id`" not-null="false" unique="false"/>
>>>>> </key>
>>>>> <list-index column="`writer_books_idx`"/>
>>>>> <one-to-many entity-name="Book"/>
>>>>> </list>
>>>>> </class>
>>>>> <class
>>>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.OneTimeWo nderImpl "
>>>>> entity-name="OneTimeWonder" abstract="false" lazy="true"
>>>>> discriminator-value="OneTimeWonder" table="`onetimewonder`"
>>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.OneTimeWonder ">
>>>>> <meta attribute="eclassName">OneTimeWonder</meta>
>>>>> <meta
>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>> <id name="id" type="long" unsaved-value="0">
>>>>> <column not-null="true" unique="false" name="`id`"/>
>>>>> <generator class="foreign">
>>>>> <param name="property">theAuthor</param>
>>>>> </generator>
>>>>> </id>
>>>>> <discriminator column="`dtype`" type="string"/>
>>>>> <version name="e_version" column="e_version"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>> </version>
>>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>> </property>
>>>>> <one-to-one name="theAuthor" entity-name="Author"
>>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"
>>>>> constrained="true"/>
>>>>> </class>
>>>>> <class
>>>>> name=" org.eclipse.emf.teneo.samples.issues.bz242995.impl.AuthorImp l "
>>>>> entity-name="Author" abstract="false" lazy="true"
>>>>> discriminator-value="Author" table="`author`"
>>>>> proxy="org.eclipse.emf.teneo.samples.issues.bz242995.Author ">
>>>>> <meta attribute="eclassName">Author</meta>
>>>>> <meta
>>>>> attribute="epackage">http:///org/eclipse/example/library.ecore</meta>
>>>>> <id name="id" type="long" unsaved-value="0">
>>>>> <column not-null="true" unique="false" name="`id`"/>
>>>>> <generator class="native"/>
>>>>> </id>
>>>>> <discriminator column="`dtype`" type="string"/>
>>>>> <version name="e_version" column="e_version"
>>>>> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>> </version>
>>>>> <property name="Name" lazy="false" insert="true" update="true"
>>>>> not-null="false" unique="false" type="java.lang.String">
>>>>> <column not-null="false" unique="false" name="`name`"/>
>>>>> </property>
>>>>> <one-to-one name="theBook" entity-name="OneTimeWonder"
>>>>> cascade="merge,persist,save-update,lock,refresh" lazy="proxy"/>
>>>>> </class>
>>>>> </hibernate-mapping>
>>>>
>>>> ------------------------------------------------------------ --------------------
>>>>
>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <ecore:EPackage xmi:version="2.0"
>>>>> xmlns:xmi="http://www.omg.org/XMI"
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bz242995"
>>>>> nsURI="http:///org/eclipse/example/library.ecore"
>>>>> nsPrefix="org.eclipse.example.library">
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Book">
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="title"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="pages"
>>>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
>>>>> defaultValueLiteral="100"/>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="category"
>>>>> eType="#//BookCategory"/>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="author"
>>>>> lowerBound="1"
>>>>> eType="#//Writer" eOpposite="#//Writer/books"/>
>>>>> </eClassifiers>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Library">
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="writers"
>>>>> upperBound="-1"
>>>>> eType="#//Writer" containment="true"/>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
>>>>> upperBound="-1"
>>>>> eType="#//Book" containment="true"/>
>>>>> </eClassifiers>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Writer">
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
>>>>> upperBound="-1"
>>>>> eType="#//Book" eOpposite="#//Book/author"/>
>>>>> </eClassifiers>
>>>>> <eClassifiers xsi:type="ecore:EEnum" name="BookCategory">
>>>>> <eLiterals name="Mystery"/>
>>>>> <eLiterals name="ScienceFiction" value="1"/>
>>>>> <eLiterals name="Biography" value="2"/>
>>>>> </eClassifiers>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="OneTimeWonder">
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="theAuthor"
>>>>> lowerBound="1"
>>>>> eType="#//Author" eOpposite="#//Author/theBook">
>>>>> <eAnnotations source="teneo.jpa">
>>>>> <details key="value" value="@PrimaryKeyJoinColumn"/>
>>>>> </eAnnotations>
>>>>> </eStructuralFeatures>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
>>>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
>>>>> <eAnnotations source="teneo.jpa">
>>>>> <details key="value" value="@Id"/>
>>>>> </eAnnotations>
>>>>> </eStructuralFeatures>
>>>>> </eClassifiers>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Author">
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="Name"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="theBook"
>>>>> lowerBound="1"
>>>>> eType="#//OneTimeWonder"
>>>>> eOpposite="#//OneTimeWonder/theAuthor"/>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
>>>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
>>>>> <eAnnotations source="teneo.jpa">
>>>>> <details key="value" value="@Id&#xA;@GeneratedValue"/>
>>>>> </eAnnotations>
>>>>> </eStructuralFeatures>
>>>>> </eClassifiers>
>>>>> </ecore:EPackage>
>>>>>
>>>>
>>>
>>> --
>>>
>>> With Regards, Martin Taal
>>>
>>> Springsite/Elver.org
>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>> The Netherlands
>>> Cell: +31 (0)6 288 48 943
>>> Tel: +31 (0)84 420 2397
>>> Fax: +31 (0)84 225 9307
>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>> Web: www.springsite.com - www.elver.org
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org
Previous Topic:Where to put the resource of a ChangeDescription?
Next Topic:EMF Refactoring Plugin
Goto Forum:
  


Current Time: Sat Apr 20 02:36:18 GMT 2024

Powered by FUDForum. Page generated in 0.04246 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top