Formatting Issue - datatables with one to many relationship
Hi...
I am a newbie and I have designed a report in CR2008 and my datasource for the report is an XSD file. There are 2 tables Table A and B.
Table A is as follows:
AID Name Reference Period Manager
5 Name 1 Ref 1 July 2009 User Name 1
8 Name 2 Ref 2 August 2009 User Name 2
9 Name 3 Ref 3 March 2009 User Name 9
45 Name 4 Ref 4 May 2008 User Name 4
88 Name 5 Ref 5 June 2009 User Name 1
There are other coloumns too in the datatable, but that shouldnt matter.
Table B is as follows:
ID A_ID DateKey DateValue Name
1 5 Date1 2009-09-29 00:00:00.000 Start Date
2 5 Date2 2009-08-11 00:00:00.000 Fieldwork Complete
3 5 Date3 2009-08-14 00:00:00.000 Report Issued
4 5 Date4 2009-07-17 00:00:00.000 Report Finalised
5 5 Date5 2009-07-10 00:00:00.000 Close Date
6 8 Date1 2009-08-11 00:00:00.000 Start Date
7 8 Date4 2009-09-29 00:00:00.000 Report Finalised
I want the report to be in the following format:
ID Name Reference Period Manager StartDate Fieldwork ReportIssue Finalised Closed
I have written a formula to display the date value where the date key matches for A_ID.
But when I run the report I get the result as follows:
ID Name Reference Period Manager StartDate Fieldwork ReportIssue Finalised Closed
5 Name1 Ref1 July 2009 UName 1 29/09/2009
11/08/2009 14/08/2009 17/07/2009 10/07/2009
Hi
I tried what you suggested, but it hasnt worked.
In your code, you have used the date ID,
if {b.id} = 1 then
formula = {b.datevalue}
end if
but the table contains dates from several A_IDs, and I want to get the dates for the respective A_ID, So shouldnt I be matching the A_ID's first? I also dont understand how the max function helps here?
My report is already grouped by Table A, ID.
My report should be a join of the two tables, a left outer join to be exact.
Also, if my XML data contains only one record for Table A, dates still come out in a separate line. I dont quite understand where the problem is?
Thank you...
Similar Messages
-
Hi, below is my data model for SSAS 2008 on snowflake schema.
Below is SQL Server DW tables:
DimStudent - StudentID [primarykey], StudentName, DateOfBirth, AddressID
DimStudentAddresses - AddressID [primarykey], StudentID [foreignkey], ddressLine1, AddressLine2, AddressType
FactEnrolment - StudentID, EnrolWeek, EnrolFees
So here FactEnrolement.StudentID is joined to DimStudent.StudentID column,
and relationship between DimStudent & DimeStudentAddresses is one to many I.e. one student can have multiple addresses like primary or secondry address.
To design snowflake schema in SSAS 2008 BIDS project :
[Question-1] how to join one-to-many dimensions (NOT fact table) Like DimStudent & DimAddresses?
[Question-2] At the end I want to have a single dimension only I.e. Student which should have both DimStudent & DimStudentAddresses tables attributes init. So I can create hierarchy from these two table into a single dimension? How
to do this?
Please reply with feedback particular to my above scenario as I refereed other MSDN forums but nothing solid I found.
Any STEP-BY-STEP guideline please. Many thanks.Hello KM,
Have you solved this issue after refer to Bill's suggestion? Please let us know how things go.
If you have any feedback on our support, please click
here.
Best Regards,
Elvis Long
TechNet Community Support -
Confused with one to many relationship
Hi Masters ,
Reading about one to many : i came across this
Each row in Table A can have many (zero or more)
matching rows in Table B but each row in Table B
has only one matching row in Table A.
A ZipCode can have many Students but each Student has only
one ZipCode
Theoritically this would be fine but can anyone please make tables for the above so i want to see it pratical work.zip
(zipcode varchar2(6)
, low_street_number varchar2(10)
, high_street_number varchar2(10)
, odd_even char(1)
, city varchar2(30)
, constraint zip_pk primary key (zipcode)
student
(studentno number(10)
, firstname varchar2(30)
, lastname varchar2(30)
, zipcode varchar2(6)
, constraint zip_fk foreign key(zipcode) references zip_pk
Sybrand Bakker
Senior Oracle DBA -
About inserting with one to many relationship
db and dev 10g rel2 ,
hi all ,
using emp and dept tables of scott/tiger schema .
if i have a form , how can i insert 4 new employees in a specific dept ? what blocks should i build , and how can the user inserts into these blocks ?
thanks in advancethe user should write "20" in the deptno field once , and write the 4 new employees' data .To do this, you create a relationship between the blocks with the Dept block to be the Master and the Emp block to be the detail block. Your Form layout would look something like the following:
|---------------------------------------|
| [ ] Department Number |
|---------------------------------------|
| Employee data... |
| [ ] Emp ID |
| [ ] First Name |
| ...rest of the columns listed here... |
|---------------------------------------|Once you have created the relationship, Forms will handle the rest. Just run your form, select department 20 and start adding new employees.
Craig... -
One-to-many relationships problem
Hi,
I'm having some problems with one-to-many relationships.
I've a two way relationship beetwen Person and Document.
Person has a collection of Documents (1-n).
Document has an instance for Person.
In my database schema Document has a FK for person.
The problem occurs when I'm trying to save the Person object
with a collection of Documents.
Oracle gives me the following message:
ORA-00001: unique constraint (SMS.PK_PERSON) violated
In my kodo.properties file I put:
kodo.jdbc.ForeignKeyConstraints: true
It seems that when the collection of Documents is persisted, kodo tries to
save a new Person object for each Document.
When I have just one instance of Document in my collection kodo persists
it ok, but when I have move instances I get
that problem.
Can somebody help me?
Thanks in advance,
Joan CaffeeYou need to make sure each Document references the same Person object in
the JVM. JDO persists your object model as-is. Each distinct JVM
object becomes a distinct database record. You can't have multiple JVM
objects in the same PersistenceManager representing the same database
record. -
Struggling with a one to many relationship in a sub-report
Post Author: Scott_tansley
CA Forum: General
I have a database schema as per below: tblENQUIRY tblDatasheets tblReportParasIRSID (PK) 1 --> & IRSID (FK) UID (PK)Attribute1 SHEETID (PK) 1 > & SHEETID (FK)Attribute2 Attribute1 LIST_ORDER tblStandardParasAttribute3 Attribute2 PARA_CODE (FK) & < 1 CODE (PK)etc... Attribute3 TEXT etc...
The PROBLEM I am a Crystal Reports Newbie, and having to work through things bit by bitu2026 I've managed to achieve quite a lot, but I'm totally stuck with this and would appreciate some help. I need to create a report (essentially a letter and some datasheets) around a one-to-many relationship, which I have managed to compile using a main report (for the one [tblENQUIRY]) and sub report (for the many [tblDatasheets]). Essentially I need a covering letter, then the u2018manyu2019 datasheets, and then a number of other pages (which are largely static text). I have created a main report which includes the covering letter, holds a subreport for the datasheets, and then contains the text for the additional pages. This all works fine, and I get the correct number of datasheets for each main report. My problem stems from the use of this sub report. This sub-report needs to hold some attribute values for each datasheet, which is fine. However, on each datasheet page I need to have some paragraphs, which are held in another one to many relationship. Each datasheet may have up to six paragraphs held as a code in tblReportParas, with a relationship to the text as held in tblStandardParas. My original thought would have been to embed another sub report, containing the values from tblStandardParas!TEXT, into the first sub report. However, I have found that it is not possible to have a sub-report inside another sub-report. I had seperated the first sub-report out from the main report, and then embedded another sub-report into it. This worked fine until I tried to stitch the sub-report back into the main report (at which point the sub-sub-report dissapeared from view). I have therefore reworked my sub-report a little, and the attribution is now stored in a pageheader, with the tblStandardParas!TEXT in a detail section below it. This almost works! The only problem is that there is no relationship between the pageheader and detail sections. To clarify, I would expect to have one datasheet, with the attribution at the top, and then the six paras below. Then, the same on the next page (assuming there is a second datasheet) for that report. Instead, I get the correct attribution, but the detail section actually gives every paragraph in the database, no matter which datasheet/or report it related to! I therefore need to limit the detail section to only show those paragraphs where the SHEETID in tblReportParas is the same as the tblDatasheets SHEETID. Any offers of advice would be appreciated.Post Author: Scott_tansley
CA Forum: General
I managed to resolve this myself in the end. I moves the tblEnquiry data into report header/footer sections, this allowed me to add the tblDatasheets information into the details section, which gave me multiple pages - and then finally, the Paragraphs were added through the use of a sub report.
There's probably an even better way, but for now it works, it's quick - and so I'm going to go with it!
Thanks for your interest. -
One-to-many relationship: problem with several tables on the one side...
Hello
I'm having problems developing a database for a content management system. Apart from details, I've got one main table, that holds the tree structure of the content ("resources") and several other tables that contain data of a particular datatype ("documents", "images", etc.). Now, there's one-to-many relationship between "resources" table and all the datatype tables - that is, in the "resources" table there's "resource_id" column, being a foreign key referenced to the "id" columns in the datatype tables.
The problem is that this design is deficient. I can't tell form the "resource_id" column from which datatype table to get the data. It seems to me that one-to-many relationship only works with two tables. If the data on the one side of the relationship is contained in several tables, problems arise.
Anybody knows a solution? I would be obliged.
Regards
HavocadoHi;
A simple way may be create a view on referenced tables:
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> drop table resources;
Table dropped
SQL> create table resources(id number, name varchar2(12));
Table created
SQL> insert into resources values(1,'Doc....');
1 row inserted
SQL> insert into resources values(2,'Img....');
1 row inserted
SQL> drop table documents;
Table dropped
SQL> create table documents(id number, resource_id number,type varchar2(12));
Table created
SQL> insert into documents values(1,1,'txt');
1 row inserted
SQL> drop table images;
Table dropped
SQL> create table images(id number, resource_id number,path varchar2(24));
Table created
SQL> insert into images values(1,2,'/data01/images/img01.jpg');
1 row inserted
SQL> create or replace view vw_resource_ref as
2 select id, resource_id, type, null as path from documents
3 union
4 select id, resource_id, null as type, path from images;
View created
SQL> select * from resources r inner join vw_resource_ref rv on r.id = rv.resource_id;
ID NAME ID RESOURCE_ID TYPE PATH
1 Doc.... 1 1 txt
2 Img.... 1 2 /data01/images/img01.jpg
SQL> Regards.... -
One to Many Relationship Issue
Post Author: jmb1977
CA Forum: Formula
I am having a problem in which I have a one to many relationship with contact phone numbers and students. In other words, one student can have multiple contacts. (I work for a school district)
I made up two formulas...called Contact1Phone and Contact2Phone.
Here is the code I use to display the data:
IF {STUDCTCT.CNTNUMBER} in ["C1"] THEN STDUCTCT.CNTWPHONE
Then the other formula does the same, except uses "C2".
What I get is either C1 or C2 displays, but never both for the same student. Anyway to make this work? Any help on this would be greatly appreciated!Post Author: jmb1977
CA Forum: Formula
I forgot to add, I do know that placing STUDCTCT.CNTNUMBER in [C1,C2] as a selection then just simply place the CNTWPHONE field into the details section of the report will give me the results. But the reason why I am trying it the other way is that I can export the data as one record per student, thus I am trying to put the fields and formulas into the group section. -
One to many relationship leads to recursion?
Hi,
I've created a web services function which returns an object retrieved from a database using the persistence api (the class was generated by the Netbeans 5.5 "Entity Class from Database" feature.
I can successfully return an object which has no foreign keys. However, when I try to retrieve an entity which is on either side of a 1:N relationship, I receive a stackOverflowError.
Here's my sample schema (I'm using Derby bundled with SJAS 9 for testing)
create table Address (
Id int not null,
StreetName varchar(255),
City varchar(255),
PostalCode varchar(255),
Party int,
primary key (Id)
create table Party (
Id int,
Name varchar(255),
primary key(Id)
alter table Address add constraint foreign key (Party) references Party;So as you can see, one Party might have many addresses.
I can retrieve either an Address or Party from the database using something like:
em.createNamedQuery("Party.findById")
.setParameter("id", 1)
.getSingleResult();When I try to return it, I get a stackOverflowError in the server log. I'm using the default Toplink provider so enabling full logging on this, I can see the SQL.
When retrieving an address, it selects all of the address fields and correctly binds the supplied Id value. It then performs a select on the Party table using the Address.Party value. This in turn causes it to attempt to retrieve an Address. After three queries, the error is thrown.
I can't see why the above schema should cause this problem. Where an Address is requested, I would expect it to retrieve the address fields, including the value of the Party field but not the Party object itself. On the other hand. when a Party is retrieved, I would expect it to recurse through and return a collection of Address objects.
Have I misunderstood this or am I missing some fundamental point about JAX-WS?
Thanks for your help,
-PhilYou have to set both sides of the relations...
for example to do this in a more seamless manner:
public UserProfile
public void addLog (UserActivityLog activity)
logs.add (activity);
if (!equals (activity.getUserProfile ()))
activity.setUserProfile (this);
Now this is the most primitive of ways to maintain two sided relations.
There are a lot of other patterns to get around this.
If you want to set the UserActivityLog to a specific UserProfile without
having a firm reference to ther UserProfile, you should get the object
from the database/persistenceManager... as you are using application
identity, you can do something like pm.getObjectById.
JDO does not do magic references. If you set something to null, it will
remain null until you set it.
Srini wrote:
Hi Guys
I am trying to create a one to many relationship between 2 JDOs.
UserProfile - User JDO having user info
UserActivityLog - JDO having user log info
UserProfile -- UserActivityLog
1 many
UserProfile - has a collection of UserActivityLog objects
UserActivityLog - has a reference to UserProfile
Qn 1:
I created a UserProfile along with a collection of 2 UserActivityLog
objects.
Navigation:
Now given a UserProfile object,i am able to get the UserActivityLog objects.
But given a UserActivityLog object ,i get a NULL UserProfile object.
Issues:
Why this is happening???Do i need to set the reference for "UserProfile" in
UserActivityLog before inserting???
If so,then how do i add a UserActivityLog to an existing
UserProfile???cos,if i create a UserActivityLog with reference to
UserProfile ,then it will throw a Duplicate Key violation for UserProfile as
it is already persisted in DB.
It will be great if you can direct me to some one to many relationship
examples already implemented.
Thanks
Srini
Stephen Kim
[email protected]
SolarMetric, Inc.
http://www.solarmetric.com -
Need help mapping one-to-many relationship
[Sorry, inadvertently cross-posted]
Hello,
I have a one-to-many mapping question that's probably a no-brainer for the
experts of the group out there. My problem is that I can't get a collection
of Items for a given Theme to be populated and I don't know if it's a
problem in my system.jdo or in my classes (or both). For example, for Theme
10,
I want a collection of two Items, item_ids 1 and 2.
I have db tables named ITEM and THEME with the following layouts:
ITEM
|==========================================================|
| item_id(pk) | item_name | item_number | theme_id(fk) |
|==========================================================|
| 1 | This is Item1 | 1234 | 10 |
| 2 | This is Item2 | 2954 | 10 |
| 3 | This is Item3 | 2094 | 17 |
| 4 | This is Item4 | 946 | 11 |
| ... |
|==========================================================|
THEME
|=======================================|
| theme_id(pk) | theme_description |
|=======================================|
| 4 | Space |
| 10 | Town |
| 11 | Train |
| 17 | Pirate |
| ... |
|=======================================|
I have two PersistenceCapable classes that map to the above tables:
package com.lego.data;
public class Item
public int item_id;
private String item_number;
private String item_name;
private int theme_id;
public Theme theme;
public String toString()
return
item_number+":"+item_name+":"+theme.getCode()+":"+theme.getDescription();
package com.lego.data;
import java.util.*;
public class Theme
public int theme_id;
public String theme_description;
public Collection items;
public String toString()
return theme_id+":"+theme_description;
and here is my system.jdo file:
<?xml version = "1.0" encoding = "US-ASCII"?>
<jdo>
<package name="com.lego.data">
<class name="Item" identity-type="application"
objectid-class="com.lego.data.IntOId">
<extension vendor-name="kodo" key="table" value="item"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="class-column" value="none"/>
<field name="item_id" primary-key="true">
<extension vendor-name="kodo" key="data-column" value="item_id"/>
</field>
<field name="item_number">
<extension vendor-name="kodo" key="data-column" value="item_number"/>
</field>
<field name="item_name">
<extension vendor-name="kodo" key="data-column" value="item_name"/>
</field>
<field name="theme_id">
<extension vendor-name="kodo" key="data-column" value="theme_id"/>
</field>
<field name="theme">
<extension vendor-name="kodo" key="theme_id-data-column"
value="theme_id"/>
</field>
</class>
<class name="Theme" identity-type="application"
objectid-class="com.lego.data.ThemeKey">
<extension vendor-name="kodo" key="table" value="theme"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="class-column" value="none"/>
<field name="theme_id" primary-key="true">
<extension vendor-name="kodo" key="data-column" value="theme_id"/>
</field>
<field name="theme_description">
<extension vendor-name="kodo" key="data-column"
value="theme_description"/>
</field>
<field name="items">
<collection element-type="Item"/>
<extension vendor-name="kodo" key="inverse" value="theme"/>
</field>
</class>
</package>
</jdo>
Thanks in advance for the help.
-TimAbe White wrote:
The first thing to check is that you are always setting the "theme" field in
your Items. If you add an Item i to the "themes" collection of a Theme t, but
forget to also set i's "theme" field to t, then the change will never get
written to the database.
Next, make sure that whenever you set the "theme" field of an Item, you also
set
its "theme_id" field. You map both of these fields to the same column, so you
better be sure they stay in synch.
On a related note, you might try making the "theme_id" field non-persistent if
things still aren't working for you. Mapping two fields to the same column
might be causing trouble. It would be safer to make theme_id non-persistent
anyway, and to always grab the id from the Theme stored in your "theme"
field.
Better OO programming and all that, though I can see that you might have
performance issues in mind when doing it your way.
Anyway, if you find that it works when you make theme_id nonpersistent, let us
know and we'll see why the double-mapping of the column is causing problems,
and hopefully find a fix.Abe,
Thanks for the response but I'm still confused. I failed to mention that
the Item and Theme tables are in an existing schema, so as you saw in my
system.jdo, I am specifying application identity.
Since this is an existing schema, the Item table has theme_id as the
foreign key to the Theme table. So are saying that it is a problem to map
the both theme_id as a data column and a Theme object in the Item at the
same time?
I guess what I don't understand is exactly what my system.jdo should look
like to map a one-to-many relationship. In my case, from Theme (1) to Item
(many). (See my system.jdo in previous post).
Thanks
-Tim -
Maintain One-to-Many relationship
Hey Guys,
I need to design a Repository in which i have to maintain one-to-many relationship. A Customer can have multiple Countries associated with it. i will get an XML file from PI and i need to import this (via Import Manager or MDIS) into MDM.
the XML file will look something like below :
<?xml version="1.0" encoding="UTF-8" ?>
- <ProductsMsg>
- <Products>
<CompanyName>XYZ</CompanyName>
- <Country>
<Name>US</Name>
</Country>
- <Country>
<Name>IN</Name>
</Country>
- <Country>
<Name>UK</Name>
</Country>
</Products>
</ProductsMsg>
As you can see above,"CompanyName" occurs only once but "Country" is occuring multiple times within the XML."CompanyName" is a text field but "Country" field must come from a lookup table.Now how will i design the repository for this?
I know i can define "CompanyName" as xsd:string in repository but how will i define "Country" field? what kind of lookup will it be ?
Also i would need to syndicate this file later on (to other systems) in the same format (one "CompanyName" but multiple "Country" tags with it) so the design of repository should be able to handle this syndication requirement as well.
Thanks
SaifOops sorry, duplicate Post
-
Merge Two Reports in Excel Analyzer - One To Many Relationship
I want to show AR Data with CO Data - e.g. a bill + Income and it's associated account ssignemnt on the FI/CO side. I want the report to be able to show a cost centre manager to be wary of the income credited to their cost centre when a debtor has been raisedaas they may not fully pay the bill. To do this I'm using the standard DSO for AR & GL line items. Fisrtly I run a query on GL line item data where the user can select from a cost centre variable to look at credits to their cost centre. This produces a list of source documents that are used (via replacement path variable) in a second query. The second GL Query gives me a list of the allocation numbers for those line items. Had to be two queres as there are two GL postings that needed linking (this is because the cost assignment comes from a ceratin acc type and the debtor information comes from another acc type). I then use the allocation number (again via a replacement path variable) to run a third query on the AR data that shows all bills and payments linked to that allocation number. It seems to work ok.
However I have put these three queries in an Excel Analyzer workbook. All the user does is enter a cost centre when running the report. Each query is on a different sheet but what I'd like to do is merge the data on to the one sheet. I want to see the bill and it's payments from the AR data matched up with the cost assignment from the FI/CO data. This would be a one to many relationship e.g. one bill may have it's cost assignment split over more than one cost centre. Is there anyway to do this using simple excel functionality?
So I'd like to see:
Allocation No. 12345 Bill £100 Revenue £50 Cost Centre 1234 £25
Cost Centre 2345 £25
Anybody any ideas?Hi,
Thanks for your answers.
I did explore using infosets but really struggled with joining the data and getting a sensible output. For example where a bill was done in installments I was getting 12 lines (e.g. one for each month) rather than just one. THis meant it looked liked they'd paid twleve times as much etc.
I did also try report to report. Which to my mind worked ok. Except the customer wanted it all in "One" report rather than having to drill down to see data.
I'll try a multiprovider but I'm worried that I'll end up with similar issues as I had when using the infoset.
Cheers
Joel -
Techniques to eliminate ripple loading in one to many relationships
Hi,
In my domain model, I have a class O that has a one to many relationship with class M. The relationship is mapped in TOPLink as a one to many from O to M, and a one to one from M to O.
An end user logs into our application that has an otherwise cold TOPLink cache and executes a use case that will render several to many aspects of each O instance, and there are many O instances to render a majority of the time.
The first time a question is asked of an O instance that requires its M instances to answer the question, TOPLink will detect the unstubbing of that ValueHolder, and cause a SQL query to pull in the necessary M instances for that O instance.
One technique to combat this ripple load is to mark the relationship between O and M to "useBatchReading". I am motivated to attempt a different technique in the particular scenario I am experiencing though.
Another technique would seem to be to fetch all of the M instances for all of the O instances to be rendered, compute the relevant Collection of M instances for each O instance and then call mValueHolder.setValue(readCollectionOfMs) on each O instance. Is this technique feasible? Seems like it doesn't align with the intent of the TOPLink API.
Are there any other techniques that can be used to solve this issue as well?
Thanks,
DougDoug,
What I believe you want is join and batch reading configured on the queries of your specific use case. That gives you much finer control then configuring these on the mappings.
With TopLink you should have your use cases issue a fixed quantity of SQL statements irrelevant of the # of objects returned from the root query.
Have you taken a look at the performance tuning chapter in the documentation?
I hope this helps,
Doug -
ONE-to-MANY relationship between tables and forms in APEX
I recently started using APEX and I have run into an issue.
I have a ONE-TO-MANY relationship between two tables, A1 and A2, respectively.
A1:
A1_ID
Item
A2:
A2_ID
SubItem
A1_ID
I have 2 forms (lets call it F1 and F2) that I use to capture data for A1 and A2.
On F2, I have the following fields that are setup to capture data:
A2.A1_ID
**A1.Item (this is a drop down that is populated using a SELECT statement where the select uses A1.Item field)
A2.SubItem (user would enter SubItem)
Note: A2.A2_ID is populated using a SEQ
Everytime I pick **A1.Item on F2, is there a way to link to A1 table and display A1.A1_ID for every **A1.Item selected on F2?
If so, I want to store the value captured in F2 for the A1_ID field into A2 table to maintain my 1-to-MANY relationship.
If this will work, how do I go about implementing this solution?
Can someone help me?I think it sounds like you are asking for a Master-Detail form. Try that and see what you get.
chris. -
How to insert data in a one-to-many relationship
How do you insert data into the client, my model entity beans have a one-to-many relationship.
PARENT ENTITY BEAN
PARENT-ID
PARENT-NAME
The ejbCreate(Integer parentID,String name)
CHILD ENTITY BEAN
CHILD-ID
CHILD-NAME
PARENT-ID(foreign key of PARENTID).
ejbCreate(Integer parentID,String name,String foreignparentID)
In a jsp page i collect the parent details and 3 corresponding chld details in a text box.
Can you please tell me how do i proceed from here...
ie. how to i insert data into the entity beans..
Do i pass the child as a collection, and within parents ejbCreate() method do i lookup for the childs home interface and insert one -by -one from the collection.
1. Considering the above example, can some one pls tell how the ejbCreate() mehod signatures, for the parent and child entity beans should be.
2. Pls also show some sample client code as to how to make an insertion.
3. In case you are passing a collection of child data, then in what format does one have to insert into a collection and also how does the container know how to insert the values in the child table , bcoz we are passing as a collection.
4.In case collections cannot be inserted do we need to iterate into the collection in parent's ejbCreate() method, and manually insert into the database of the childtable, thereby creating child entity beans.
Thanks for your time and support...
regards
kartikHi,
3. In this case of course child's ejbCreate(and postCreate) looks like
ejbCreate(Integer childID,String name,ParentLocal parent) {
setId(Id);
setName(name);
ejbPostCreate(Integer childID,String name,ParentLocal parent) {
setParent(parent);
Here you don't need IDs, but it happens only using Locals, not Remotes, if I'm not wrong. Container does it itself.
1. Of course, if you have parent.getChildren() and parent.setChildren() then you don't need any loops, but it should be done anyway in postCreate, because in ejbCreate there no parent exists yet.
Once more 3: example - I'm using JBoss 3.2.5 as EJB container. It has tomcat inside and EJB and JSP+Struts use the same jvm. It means for me that I don't need to use remote interfaces, just locals. And in this case I can implement ejb-relations. So, a have the abstract method parent.getChildren() which returns Collection of ChildLocal - s and method parent.setChildren(Collection childrenLocals) which creates/modifies children by itself.
I have not used remotes for a long time, but as I remember it was not possible to implement ejb-relations using remotes.
regards,
Gio
Maybe you are looking for
-
when i open iphoto i see my photo's for 1 second and then they are gone .The photo's are still there but i can see them only on the bottom or top of my screen when i try to open them i get a sign that it is not possible.Can somebody please help me?
-
Generics in a dynamic context - solutions?
Let's assume that we have a two level hierarchy of gizmos. Say the parent class is called AbstractGizmo, with children Gizmo1, Gizmo2, Gizmo3, ..... In addition you have a Gizmo generator class to generate gizmos in a variety of ways, here is one of
-
Is there a list somewhere of HP Failure IDs and what they mean?
I'm getting the following Failure ID when I run system disgnostic test on the HDD in a HP Envy U0823F-6BA705-XD7X1F-60UE03 Anyone know what it means or where I can find out? The disk itself appears to be running ok. I ran a chkdsk \F on it in a separ
-
Purchasing items from other countries?
is there any way to purchase something from an itunes store in another country?
-
My question is how can i put Pdf files to my iPad Mini.