|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
customize OneToMany MappingHi, i need to
create a OneToManyMapping for the following problem SELECT *
FROM target_table JOIN
table_between ON table_between.target_table_id = target_table.id WHERE
table_between. source_id = ? How can I
solve this problem with the EclipseLink native API (I neither use JPA nor annotations) Thanxs Sepp Mit Windows Live können Sie Ihre Fotos organisieren, bearbeiten und freigeben. _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: customize OneToMany MappingHi Sepp,
Have you taken a look at any of the getting started documentation? Here are some links: - The base page for the orm documentation http://wiki.eclipse.org/Category:ORM - An intro to OneToMany http://wiki.eclipse.org/Introduction_to_Relational_Mappings_%28ELUG%29#One-to-Many_Mapping - An intro to using our GUI tool (Mapping Workbench) to create mappings http://wiki.eclipse.org/Creating_a_Mapping_%28ELUG%29#Creating_Mappings_Manually_During_Development - Some information about altering mappings in custom ways in section "Using a Parameterized Expression in a Mapping" http://wiki.eclipse.org/Introduction_to_EclipseLink_Expressions_(ELUG) () - Some sample code from our test framework can be found here: http://fisheye2.atlassian.com/browse/~raw,r=4604/eclipselink/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/employee/relational/EmployeeProject.java -Tom Robert Wimmer wrote: > Hi, > > > > i need to create a OneToManyMapping for the following problem > > > > SELECT * FROM target_table > > JOIN table_between ON table_between.target_table_id = target_table.id > > WHERE table_between. source_id = ? > > > > How can I solve this problem with the EclipseLink native API (I neither > use JPA nor annotations) > > > > Thanxs Sepp > > > ------------------------------------------------------------------------ > Mit Windows Live können Sie Ihre Fotos organisieren, bearbeiten und > freigeben. > <http://www.microsoft.com/austria/windows/windowslive/products/photo-gallery-edit.aspx> > > > ------------------------------------------------------------------------ > > _______________________________________________ > eclipselink-users mailing list > eclipselink-users@... > https://dev.eclipse.org/mailman/listinfo/eclipselink-users eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
RE: customize OneToMany Mappingto answer your question > Have you taken a look at any of the getting started documentation? yes, i have taken a look to all of these documents before posting here - and some of them are really helpfull. i also built successfully some projects useing - Sessions, - Classdescriptors, - DirectFieldMappings, - OneToManyMappings, - OneToManyMappings - ExpressionBuilder ... with oracle and postgresql using eclipse-link. the most helpfull document for me was > - Some sample code from our test framework can be found here: > http://fisheye2.atlassian.com/browse/~raw,r=4604/eclipselink/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/employee/relational/EmployeeProject.java to give you an example about my knowledge in eclipse-link OneToManyMapping mtm = new OneToManyMapping(); mtm.setAttributeName("contacts"); mtm.setReferenceClass(Contact.class); mtm.addTargetForeignKeyFieldName("contact.person_id", "person.id"); mtm.dontUseIndirection(); personDescriptor.addMapping(mtm); so far i am able to generate an OTM mapping. back to the original problem > > i need to create a OneToManyMapping for the following problem > > > > SELECT * FROM target_table > > > > JOIN table_between ON table_between.target_table_id = target_table.id > > > > WHERE table_between. source_id = ? some pseudo-code (which methods in which order) really would help me a lot. Another problem is, that in the intended project the persistence layer should be as generic as possible and use the eclipse-link "native" Java-API. no JPA, no XML and at least no annotations. The mapping should be generated dynamic from metadatdescription held in the DB itself. The intended way to map the database data is without the usage of one java class per ClassDescriptor. unlike public class Address { String firstname,lastname .... } we would like to use something like //AddressTupel = new TupelMappingInterface(); ... AddressTupel.addField("firstname",String.class); AddressTupel.addField("lastnam",String.class); ... ClassDescriptor.setJavaInterface(AddressTupel); regards and thanks in advance Sepp P.S.: something like public void customize(ClassDescriptor descriptor) {
as found on http://wiki.eclipse.org/Configuring_a_Relational_One-to-Many_Mapping_(ELUG) does not help me in any way.Hol dir noch heute die neue Beta des Windows Live Messengers! Hier klicken! _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: customize OneToMany MappingHi Sepp,
EclipseLink can work in JPA and with Native API. You can even use JPA API and native metadata in combination - which might be a good thing for you to consider since it will allow you to avoid using annotations and orm.xml, but allow you to still use the standardized API> The construct you are interested in is called a Project by EclipseLink. A Project holds the metadata about a project. You should be able to access the project and modify it through some of our JPA customization events, or in native API through our prelogin event. Before JPA, the typical way to use EclipseLink (then called TopLink) was to use the MappingWorkbench to describe your metadata and export either Java code or an XML document that contains that metadata. I realize that will not get you all the way to your goal. If you use the facility to export java code, it will, however give you a way to generate and see the type of java code that EclipseLink expects for its descriptors and mappings - a way to prototype. Can you provide a more in-depth description of the mapping you are trying to create between target_table and table_between. i.e. The classes involved and the relevant instance variables and the tables involved. The reason I ask is that based on your initial description, I was under the impression this is a typical 1-M mapping, but it seems it may not be. There is an JPA based example of how you might work without predefined classes here: http://wiki.eclipse.org/EclipseLink/Examples/JPA/Dynamic Although it is JPA-based, it may provide you with some ideas. -Tom Robert Wimmer wrote: > Hi Tom, > > to answer your question > > > Have you taken a look at any of the getting started documentation? > > yes, i have taken a look to all of these documents before posting here - > and some of them are really helpfull. i also built successfully some > projects > useing > > - Sessions, > - Classdescriptors, > - DirectFieldMappings, > - OneToManyMappings, > - OneToManyMappings > - ExpressionBuilder > ... > > with oracle and postgresql using eclipse-link. the most helpfull > document for me was > > > - Some sample code from our test framework can be found here: > > > http://fisheye2.atlassian.com/browse/~raw,r=4604/eclipselink/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/employee/relational/EmployeeProject.java > > to give you an example about my knowledge in eclipse-link > > OneToManyMapping mtm = new OneToManyMapping(); > mtm.setAttributeName("contacts"); > mtm.setReferenceClass(Contact.class); > mtm.addTargetForeignKeyFieldName("contact.person_id", "person.id"); > mtm.dontUseIndirection(); > personDescriptor.addMapping(mtm); > > so far i am able to generate an OTM mapping. back to the original problem > > > > i need to create a OneToManyMapping for the following problem > > > > > > SELECT * FROM target_table > > > > > > JOIN table_between ON table_between.target_table_id = target_table.id > > > > > > WHERE table_between. source_id = ? > > some pseudo-code (which methods in which order) really would help me a lot. > > Another problem is, that in the intended project the persistence layer > should be as generic as possible and use the eclipse-link "native" > Java-API. no JPA, no XML and at least no annotations. The mapping should > be generated dynamic from metadatdescription held in the DB itself. The > intended way to map the database data is without the usage of one java > class per ClassDescriptor. > > unlike > > public class Address { > > String firstname,lastname .... > > } > > we would like to use something like > > //AddressTupel = new TupelMappingInterface(); > ... > AddressTupel.addField("firstname",String.class); > AddressTupel.addField("lastnam",String.class); > ... > > ClassDescriptor.setJavaInterface(AddressTupel); > > regards and thanks in advance > > Sepp > > P.S.: something like > > public void customize(ClassDescriptor descriptor) { > OneToManyMapping mapping = new OneToManyMapping(); > > // configure mapping > ... > > // add mapping to descriptor > descriptor.addMapping(mapping); > } > > as found on > http://wiki.eclipse.org/Configuring_a_Relational_One-to-Many_Mapping_(ELUG) > <http://wiki.eclipse.org/Configuring_a_Relational_One-to-Many_Mapping_%28ELUG%29> > does not help me in any way. > > > ------------------------------------------------------------------------ > Hol dir noch heute die neue Beta des Windows Live Messengers! Hier > klicken! <http://download.live.com/> > > > ------------------------------------------------------------------------ > > _______________________________________________ > eclipselink-users mailing list > eclipselink-users@... > https://dev.eclipse.org/mailman/listinfo/eclipselink-users _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
RE: customize OneToMany Mappingthanks for your response > > Can you provide a more in-depth description of the mapping you are trying to > create between target_table and table_between. i.e. The classes involved and > the relevant instance variables and the tables involved. The reason I ask is > that based on your initial description, I was under the impression this is a > typical 1-M mapping, but it seems it may not be. > public class Contact { Long id; String type,label; } public class Address { Long id; String firstname,lastname; List <Contact> contacts; } The Tables look like this (PostgreSQL Syntax) CREATE TABLE contact ( id BIGSERIAL PRIMARY KEY, TEXT type, TEXT label ); CREATE TABLE person ( id BIGSERIAL PRIMARY KEY, TEXT firstname, TEXT lastname ); CREATE TABLE contact_person ( contact_id BIGINT NOT NULL REFERENCES contact(id), person_id BIGINT NOT NULL REFERENCES person(id) ); So the query for the contacts of a person i have to do the following SELECT * FROM contact c JOIN contact_person cp ON cp.contact_id = c.id WHERE cp.person_id = ? This is indirection is used really often and it is some sort of a design standard (the reason is you can establish new relationships between tables without changing the table definition itself). So how can I desribe this kind of relationship with the eclipselink api ? Is it possible with a OneToMany mapping OneToManyMapping mtm = new OneToManyMapping(); Thanks in Advance Sepp P.S.: I also dont know who to define Postgres Secquences in eclipselink and find no help in the Web for it. Any Idea ? Teilen Sie Ihre Erinnerungen mit jeder beliebigen Person online beliebigen Person online. _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: customize OneToMany MappingHi Sepp,
Now I understand. It was not clear from your previous description of the problem that you want to map OneToOne mapping with a join table. That functionality is actually very new in EclipseLink - part of our work on the JPA 2.0 specification, but it is available on our latest stream. Some details can be found at these links: http://wiki.eclipse.org/EclipseLink/Development/JPA2.0/one-to-one_via_jointable https://bugs.eclipse.org/bugs/show_bug.cgi?id=282553 Please note, this functionality is only currently available on our recent 2.0 nightly builds. There is support for defining sequence objects, but the public access is through our JPA DDL generation feature. For those that are not using JPA, this is a more difficult question. It may be easier to just create them on the DB and use them from EclipseLink. If you are set on using EclipseLink to create sequences, there is some example code in our testing framework in our core test framework. (org.eclipse.persistence.testing.tests.feature.OracleNativeSeqInitTest) -Tom Robert Wimmer wrote: > Hi Tom, > > thanks for your response > > > > > Can you provide a more in-depth description of the mapping you are > trying to > > create between target_table and table_between. i.e. The classes > involved and > > the relevant instance variables and the tables involved. The reason I > ask is > > that based on your initial description, I was under the impression > this is a > > typical 1-M mapping, but it seems it may not be. > > > > public class Contact { > Long id; > String type,label; > } > > public class Address { > Long id; > String firstname,lastname; > List <Contact> contacts; > } > > The Tables look like this (PostgreSQL Syntax) > > CREATE TABLE contact ( > id BIGSERIAL PRIMARY KEY, > TEXT type, > TEXT label > ); > > CREATE TABLE person ( > id BIGSERIAL PRIMARY KEY, > TEXT firstname, > TEXT lastname > ); > > CREATE TABLE contact_person ( > contact_id BIGINT NOT NULL REFERENCES contact(id), > person_id BIGINT NOT NULL REFERENCES person(id) > ); > > So the query for the contacts of a person i have to do the following > > SELECT * FROM contact c > JOIN contact_person cp ON cp.contact_id = c.id > WHERE cp.person_id = ? > > This is indirection is used really often and it is some sort of a design > standard (the reason is you can establish new relationships between > tables without changing the table definition itself). > > So how can I desribe this kind of relationship with the eclipselink api > ? Is it possible with a OneToMany mapping > > OneToManyMapping mtm = new OneToManyMapping(); > mtm.setAttributeName("contacts"); > mtm.setReferenceClass(Contact.class); > ??? mtm.addTargetForeignKeyFieldName("contact.id", "contact_person.contact_id"); > ??? > ??? mtm.dontUseIndirection(); > personDescriptor.addMapping(mtm); > > > Thanks in Advance Sepp > > P.S.: I also dont know who to define Postgres Secquences in eclipselink > and find no help in the Web for it. Any Idea ? > > > > > > > > > > > > ------------------------------------------------------------------------ > Teilen Sie Ihre Erinnerungen mit jeder beliebigen Person online > beliebigen Person online. > <http://www.microsoft.com/austria/windows/windowslive/products/photos-share.aspx?tab=1> > > > ------------------------------------------------------------------------ > > _______________________________________________ > eclipselink-users mailing list > eclipselink-users@... > https://dev.eclipse.org/mailman/listinfo/eclipselink-users eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: customize OneToMany MappingHi Sepp,
I think I got confused a bit. (too much going on here... sorry) For a OneToMany (rather than OneToOne) with a join table, just use a ManyToMany mapping. There should be an example of one of those in the example code I pointed you at earlier. -Tom Tom Ware wrote: > Hi Sepp, > > Now I understand. It was not clear from your previous description of > the problem that you want to map OneToOne mapping with a join table. > > That functionality is actually very new in EclipseLink - part of our > work on the JPA 2.0 specification, but it is available on our latest > stream. > > Some details can be found at these links: > > http://wiki.eclipse.org/EclipseLink/Development/JPA2.0/one-to-one_via_jointable > > > https://bugs.eclipse.org/bugs/show_bug.cgi?id=282553 > > Please note, this functionality is only currently available on our > recent 2.0 nightly builds. > > There is support for defining sequence objects, but the public access > is through our JPA DDL generation feature. For those that are not using > JPA, this is a more difficult question. It may be easier to just create > them on the DB and use them from EclipseLink. If you are set on using > EclipseLink to create sequences, there is some example code in our > testing framework in our core test framework. > (org.eclipse.persistence.testing.tests.feature.OracleNativeSeqInitTest) > > -Tom > > Robert Wimmer wrote: >> Hi Tom, >> >> thanks for your response >> >> > >> > Can you provide a more in-depth description of the mapping you are >> trying to >> > create between target_table and table_between. i.e. The classes >> involved and >> > the relevant instance variables and the tables involved. The reason >> I ask is >> > that based on your initial description, I was under the impression >> this is a >> > typical 1-M mapping, but it seems it may not be. >> > >> >> public class Contact { >> Long id; >> String type,label; >> } >> >> public class Address { >> Long id; >> String firstname,lastname; List <Contact> contacts; >> } >> >> The Tables look like this (PostgreSQL Syntax) >> >> CREATE TABLE contact ( >> id BIGSERIAL PRIMARY KEY, >> TEXT type, >> TEXT label >> ); >> >> CREATE TABLE person ( >> id BIGSERIAL PRIMARY KEY, >> TEXT firstname, >> TEXT lastname >> ); >> >> CREATE TABLE contact_person ( >> contact_id BIGINT NOT NULL REFERENCES contact(id), >> person_id BIGINT NOT NULL REFERENCES person(id) >> ); >> >> So the query for the contacts of a person i have to do the following >> >> SELECT * FROM contact c >> JOIN contact_person cp ON cp.contact_id = c.id >> WHERE cp.person_id = ? >> >> This is indirection is used really often and it is some sort of a >> design standard (the reason is you can establish new relationships >> between tables without changing the table definition itself). >> >> So how can I desribe this kind of relationship with the eclipselink >> api ? Is it possible with a OneToMany mapping >> >> OneToManyMapping mtm = new OneToManyMapping(); >> mtm.setAttributeName("contacts"); >> mtm.setReferenceClass(Contact.class); >> ??? mtm.addTargetForeignKeyFieldName("contact.id", >> "contact_person.contact_id"); >> ??? ??? mtm.dontUseIndirection(); >> personDescriptor.addMapping(mtm); >> >> >> Thanks in Advance Sepp >> >> P.S.: I also dont know who to define Postgres Secquences in >> eclipselink and find no help in the Web for it. Any Idea ? >> >> >> >> >> >> >> >> >> >> >> >> ------------------------------------------------------------------------ >> Teilen Sie Ihre Erinnerungen mit jeder beliebigen Person online >> beliebigen Person online. >> <http://www.microsoft.com/austria/windows/windowslive/products/photos-share.aspx?tab=1> >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> eclipselink-users mailing list >> eclipselink-users@... >> https://dev.eclipse.org/mailman/listinfo/eclipselink-users > eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
RE: customize OneToMany Mapping> For a OneToMany (rather than OneToOne) with a join table, just use a > ManyToMany mapping. There should be an example of one of those in the example > code I pointed you at earlier. as you suggested i tried it with a ManyToManyMapping, but only with some success my Mapping definition ... ManyToManyMapping mmm = new ManyToManyMapping(); mmm.setAttributeName("posten"); mmm.setReferenceClass(Posten.class); mmm.dontUseIndirection(); mmm.setRelationTableName("wpt_posten_bestellungen_lbez"); mmm.addSourceRelationKeyFieldName("wpt_posten_bestellungen_lbez.wpt_bestellungen_id","WPT_BESTELLUNGEN.TID"); mmm.addTargetRelationKeyFieldName("wpt_posten_bestellungen_lbez.wpt_bestellposten_liste_id","WPT_BESTELLPOSTEN_LISTE.TID"); wptBestellungenDescriptor.addMapping(mmm); ... the problem is it only returns 1 row instead of multiple rows to make it clearer some sql -- the "handmade" query SELECT liste.tid,liste.eintrag FROM wpt_bestellposten_liste liste JOIN wpt_posten_bestellungen_lbez lbez ON lbez.wpt_bestellposten_liste_id = liste.tid JOIN wpt_bestellungen b ON lbez.wpt_bestellungen_id = b.tid WHERE b.tid = 119.9; -- returns 5 records (es expected) -- eclipselink generated query SELECT t1.TID, t2.TID, t1.EINTRAG FROM wpt_posten_bestellungen_lbez t0, WPT_BESTELLUNGEN t2, WPT_BESTELLPOSTEN_LISTE t1 WHERE (((t0.wpt_bestellungen_id = 119.9) AND (t1.TID = t0.wpt_bestellposten_liste_id)) AND (t2.TID = t1.TID) ); -- returns only 1 record -- the query eclipselink should generate SELECT t1.TID, t2.TID, t1.EINTRAG FROM wpt_posten_bestellungen_lbez t0, WPT_BESTELLUNGEN t2, WPT_BESTELLPOSTEN_LISTE t1 WHERE (((t0.wpt_bestellungen_id = 119.9) AND (t1.TID = t0.wpt_bestellposten_liste_id)) AND (t2.TID = t0.wpt_bestellungen_id) -- <<< t2.TID != t1.TID ); as you see the second AND expression is parameterized not as expected. I tried to rewrite the mapping in a lot of different ways, but never got the expected result. >Before JPA, the typical way to use EclipseLink (then called TopLink) was towhere can I download this workbench ? One main reason for not using JPA is, that i am not able to get it running in a simple RCP application (without any Application-Server). I found some links describing solutions for this problems but I am not able to develop sample applications with our own background. This is a lot easier using the "native" eclipse-link api. regards Sepp Hol dir noch heute die neue Beta des Windows Live Messengers! Hier klicken! _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
RE: customize OneToMany MappingWhere do the tables T1, and T2 come from, is Posten using multiple tables or inheritance? Please include its mappings, they may be wrong. The m-m join looks correct.
James Sutherland EclipseLink, TopLink Wiki: EclipseLink, TopLink Forums: TopLink, EclipseLink Book: Java Persistence |
|
|
RE: customize OneToMany Mapping> Where do the tables T1, and T2 come from, is Posten using multiple tables or > inheritance? Please include its mappings, they may be wrong. The m-m join > looks correct. here is the full mapping declaration where ClassBuilderUtil.createClassDescriptor is a simple helper for generating ClassDescriptor /* public static RelationalDescriptor createClassDescriptor(Class <?> guard, String schema,String table,String primaryKey, MappingDescriptor ...descriptions) */ and MappingDesriptor is an abstract baseClass for generating fieldmappings .... ClassDescriptor wptBestellungenDescriptor = ClassBuilderUtil.createClassDescriptor( WptBestellungen.class, null,"WPT_BESTELLUNGEN","TID", new DirectMappingDescriptor("tid","WPT_BESTELLUNGEN.TID") ); ClassDescriptor bestellerDescriptor = ClassBuilderUtil.createClassDescriptor( Besteller.class, null,"RELAT_INFO_APPNAME_LISTE","TID", new DirectMappingDescriptor("tid","TID"), new DirectMappingDescriptor("entry","EINTRAG") ); ClassDescriptor postenDescriptor = ClassBuilderUtil.createClassDescriptor( Posten.class, null,"WPT_BESTELLPOSTEN_LISTE","TID", new DirectMappingDescriptor("tid","WPT_BESTELLPOSTEN_LISTE.TID"), new DirectMappingDescriptor("entry","EINTRAG") ); wptBestellungenDescriptor.addTableName("WPT_BESTELLPOSTEN_LISTE"); postenDescriptor.addTableName("WPT_BESTELLUNGEN"); // 1 OneToOneMapping mapping = new OneToOneMapping(); mapping.setAttributeName("besteller"); mapping.setReferenceClass(Besteller.class); mapping.addForeignKeyFieldName("WPT_BESTELLUNGEN.RELATIONEN_INFO_ID", "RELAT_INFO_APPNAME_LISTE.TID"); mapping.dontUseIndirection(); wptBestellungenDescriptor.addMapping(mapping); ManyToManyMapping mmm = new ManyToManyMapping(); mmm.setAttributeName("posten"); mmm.setReferenceClass(Posten.class); mmm.dontUseIndirection(); mmm.setRelationTableName("wpt_posten_bestellungen_lbez"); mmm.addSourceRelationKeyFieldName("wpt_posten_bestellungen_lbez.wpt_bestellungen_id","WPT_BESTELLUNGEN.TID"); mmm.addTargetRelationKeyFieldName("wpt_posten_bestellungen_lbez.wpt_bestellposten_liste_id","WPT_BESTELLPOSTEN_LISTE.TID"); wptBestellungenDescriptor.addMapping(mmm); Project sample = ProjectBuilder.createProject("WptBestellungen"); sample.addDescriptor(wptBestellungenDescriptor); sample.addDescriptor(bestellerDescriptor); sample.addDescriptor(postenDescriptor); sample.setLogin(applyLogin()); return sample; ad 1 ) "postenDescriptor.addTableName("WPT_BESTELLUNGEN");" with a lot try and error i found out this mapping would not work withotu this regards sepp > > my Mapping definition > > ... > > ManyToManyMapping mmm = new ManyToManyMapping(); > > mmm.setAttributeName("posten"); > > mmm.setReferenceClass(Posten.class); > > mmm.dontUseIndirection(); > > mmm.setRelationTableName("wpt_posten_bestellungen_lbez"); > > mmm.addSourceRelationKeyFieldName("wpt_posten_bestellungen_lbez.wpt_bestellungen_id","WPT_BESTELLUNGEN.TID"); > > mmm.addTargetRelationKeyFieldName("wpt_posten_bestellungen_lbez.wpt_bestellposten_liste_id","WPT_BESTELLPOSTEN_LISTE.TID"); > > wptBestellungenDescriptor.addMapping(mmm); > > ... > > > > the problem is it only returns 1 row instead of multiple rows > > > > to make it clearer some sql > > > > -- the "handmade" query > > SELECT liste.tid,liste.eintrag FROM wpt_bestellposten_liste liste > > JOIN wpt_posten_bestellungen_lbez lbez ON lbez.wpt_bestellposten_liste_id > > = liste.tid > > JOIN wpt_bestellungen b ON lbez.wpt_bestellungen_id = b.tid > > WHERE b.tid = 119.9; > > -- returns 5 records (es expected) > > > > -- eclipselink generated query > > SELECT t1.TID, t2.TID, t1.EINTRAG FROM > > wpt_posten_bestellungen_lbez t0, > > WPT_BESTELLUNGEN t2, > > WPT_BESTELLPOSTEN_LISTE t1 > > WHERE (((t0.wpt_bestellungen_id = 119.9) > > AND (t1.TID = t0.wpt_bestellposten_liste_id)) > > AND (t2.TID = t1.TID) > > ); > > -- returns only 1 record > > > > -- the query eclipselink should generate > > SELECT t1.TID, t2.TID, t1.EINTRAG FROM > > wpt_posten_bestellungen_lbez t0, > > WPT_BESTELLUNGEN t2, > > WPT_BESTELLPOSTEN_LISTE t1 > > WHERE (((t0.wpt_bestellungen_id = 119.9) > > AND (t1.TID = t0.wpt_bestellposten_liste_id)) > > AND (t2.TID = t0.wpt_bestellungen_id) -- <<< t2.TID != t1.TID > > ); > > > > as you see the second AND expression is parameterized not as expected. > > I tried to rewrite the mapping in a lot of different ways, but never got > > the expected result. > > > >>Before JPA, the typical way to use EclipseLink (then called TopLink) was > to > >>use the MappingWorkbench to describe your metadata and export either Java > code > >>or an XML document that contains that metadata. I realize that will not > get you > >>all the way to your goal. If you use the facility to export java code, it > will, > >>however give you a way to generate and see the type of java code that > >>EclipseLink expects for its descriptors and mappings - a way to > prototype.where can I download this workbench ? > > > > One main reason for not using JPA is, that i am not able to get it running > > in a simple RCP application (without any Application-Server). I found some > > links describing solutions for this problems but I am not able to develop > > sample applications with our own background. This is a lot easier using > > the "native" eclipse-link api. > > > > regards > > > > Sepp > > > > > > _________________________________________________________________ > > Hol dir 30 kostenlose Emoticons für deinen Windows Live Messenger > > http://www.livemessenger-emoticons.com/funfamily/de-at/ > > _______________________________________________ > > eclipselink-users mailing list > > eclipselink-users@... > > https://dev.eclipse.org/mailman/listinfo/eclipselink-users > > > > > > > ----- > http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland > http://www.eclipse.org/eclipselink/ > EclipseLink , http://www.oracle.com/technology/products/ias/toplink/ > TopLink > Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink , > http://wiki.oracle.com/page/TopLink TopLink > Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , > http://www.nabble.com/EclipseLink-f26430.html EclipseLink > Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence > -- > View this message in context: http://www.nabble.com/customize-OneToMany-Mapping-tp24568733p24701765.html > Sent from the EclipseLink - Users mailing list archive at Nabble.com. > > _______________________________________________ > eclipselink-users mailing list > eclipselink-users@... > https://dev.eclipse.org/mailman/listinfo/eclipselink-users Mit Windows Live können Sie Ihre Fotos organisieren, bearbeiten und freigeben. _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
RE: customize OneToMany MappingThis issue seems to be your adding of multiple tables to the descriptor, you should not be doing this.
wptBestellungenDescriptor.addTableName("WPT_BESTELLPOSTEN_LISTE"); postenDescriptor.addTableName("WPT_BESTELLUNGEN"); // 1
James Sutherland EclipseLink, TopLink Wiki: EclipseLink, TopLink Forums: TopLink, EclipseLink Book: Java Persistence |
| Free embeddable forum powered by Nabble | Forum Help |