Many to many relationship issue
Guys,
How do we deal with the situation where we have many to many relationship between 2 different characteristics?
Thanks,
RG
Hi,
I assume you are talking about data modeling.
When you are required to decide how to model two Char with many to many relations
1. If you keep them in Same Dimension table the size of the dimension table will be more.
lets say 100 Customers & 100 Materials
Now if you keep them in same dimension..
lets say C1 will have combination of M1 till M100.similarly for other customers
So Total rows in dimension table will be 100x 100 = 10000!!!
It will again be of comparable size to fact table and not recommended.
2.You always try to define them in different dimensions
Now ,You try keeping them in diffrent dimension..in this case Customer dimension will have only 100 rows & Mateial dimension will have only 100 Rows.very small when compared to fact table size.
Hope this helps
Sriman
Similar Messages
-
Many-to-many performance issue
I realize that many-to-many joins have been discussed before (yes, I looked through many threads), but I'm having a slight variation on the issue. Our data warehouse has been functioning for a couple of years now, but we're now experiencing a dramatic degradation in report performance. I'll tell you everything I know and what I've tried. My hope is that someone will have an idea that hasn't occurred to me yet.
The troubling data links deal with accounts and account_types. Each transaction will have one account, but each account can have multiple account_types and each account_type is made up of multiple accounts. It ends up looking like this:
Transaction_cube --< account_dimension >--< account_type_table
Given the many-to-many relationship between account and account_type, this is the only architecture I could come up with that will maintain data integrity in the transaction cube.
I know that this is the cause of the performance issues because the reports run normally when this is removed. The volume of data obviously increases over time, but the problem appeared very suddenly -- not a gradual degradation that one would expect from a volume issue. The cube is partitioned by year and we're a little below last year's growth.
The other fact to throw in is that the account_type table did increase in size by an additional 30% when we first noticed the problem. However, the business was able to go back and remove half of the account_types (unused types) so now the table has fewer rows than it had before we noticed the problem (~15k rows in the account_type table).
We have tried pinning the table so that it remain in memory, but that did not help. I tried creating a materialized view combining accounts and account_types with a similar lack of improvement. I've tried adding indexes, but there is still a full-table scan. All database objects are analyzed nightly after the data load is completed.
I'm fresh out of ideas at this point. Any suggestions and/or ideas would be greatly appreciated.I've thought about that. What it would mean would be aprox. 20 additional columns for each of the different account_types. Unfortunately, that would also mean that all the reports that use the account_type would have to have a condition:
WHERE acct_type1='Income Stmt." OR acct_type2='Income Stmt." OR ....
Since the account_types are not set up in a hierarchy and there must be only one row for account, I'm not sure that this is a feasible solution.
Thank you for the suggestion. -
In powerpivot we are facing problem in resolving the many-to-many relationship between tables.
Current table schema is:
Having 4 tables-
Bills - columns are- Bill No(primary key)
Billing Fee Table-Fee ID(primary key), Bill Type, Sub Bill Type
FeeList Table-FeeList ID(primary key),Fee ID(Foriegn Key to Billingble),
Bill No(Foriegn Key to Bills)
Payments Table-Pay ID(Primary Key), Bill No(Foriegn Key to Bills)
Bills is the primary table for Feelist Table
and Payments Table -Bill No is the primary key.
Billing Fee Table is primary table for FeeList Table -
Fee ID is the primary key.
To create a pivot table using Payments Table, I need
Bill Type and Sub Bill Type. Hence fetched from
Biling Fee Table to FeeList Table based on the
Fee ID column using RELATED function.
As FeeList Table and Payments Table is having duplicate
Bill Nos, it is not possible to get Bill Type and
Sub Bill Type to Payments Table. I am trying to use LOOKUPVALUE
function to get data based on the Bill No, as there is no direct relationship exists between these two tables.
I have tried using
=LOOKUPVALUE('FeeList Table'[Sub Bill Type], 'FeeList Table'[Bill No], 'Payments Table'[Bill No]) function. But
the lookupvalue function returns an error if a duplicate is found.
Error is as below:
Calculation error in column 'Payments Table'[Sub Bill Type]: A table of multiple values was supplied where a single value was expected.
Kindly assist to resolve this issue.
ThanksHi Rekha,
What should your LOOKUPVALUE return if multiple rows are found in the FeeListTable? By the way it should work if a really finds "duplicates" (i.e. multiple times the same return value) but fails if it returns multiple rows with different values.
If you for example would want to return the first entry that was found, you could try (have not checked in PP for typos):
CALCULATE(MIN('FeeList Table'[Sub Bill Type]),
FILTER('FeeList Table',
'FeeList Table'[Bill No] = 'Payments Table'[Bill No]
Edit: a very nice way to handle Many-to-Many relationships is explained here:
http://blog.gbrueckl.at/2012/05/resolving-many-to-many-relationships-leveraging-dax-cross-table-filtering/
Julian Wissel | BI for NAV @ http://en.navbi.com | Blog @ blog.navida.eu -
Hierarchical query with many-to-many relationship
I have read with interest the creative solutions to complex hierarchical queries posted previously; they have been instructive but have not quite addressed this scenario.
We have a hierarchy table H, with columns for ID, name, parentID, and other attributes.
Within this table are a number of independent hierarchies, each existing for a different purpose.
We have a master list of hierarchies in table T which describes the purpose of each hierarchy, provides some default attributes which the nodes can inherit, and stores a unique id for each hierarchy and a pointer to the root node of the corresponding hierarchy in table H.
We have a master list of items M, with identically named columns to those in H, along with many other attributes.
The members of table M ALL belong to EACH of the Hierarchies. So we have a link table I to define the intersection of H and M.
So the leaf nodes of H are really containers for the list of elements from M which may be attached to them.
The universe of M is very volatile, with new members being added, old ones deleted, and existing ones being reclassified frequently from node to node within each hierarchy. Since the hierarchies have to be built to handle every possible scenario, so that the members of M can always find a suitable node to reside in, quite often, in fact more often than not, the majority of leaf nodes for each hierarchy are empty at any given moment.
Therefore, although we always know the root sector of a given hierarchy and can traverse downwards from there, if we worked our way up from the intersection table, we could eliminate up to 70% of the nodes of any given hierarchy from further consideration, as they don't need to be (in fact, must not be) included in reports.
As implied by the above, rows in M are structurally similar (in terms of columns, but not in any real world sense) and are a superset of rows in H. But combining them into the one table doesn't seem to help the reporting process due to the many-to-many relationship which prevents the ID/parentID relationship from being carried through to this level.
There are a number of other considerations of which the most pertinent is that the people using this database generally have an interest in only a subset of the master list of items in M. This relationship is also dynamic but important enough and rigid enough that another link table P exists to combine the Users in table U with the subset of M in which they are interested. (The users are also grouped into hierarchies of a totally different nature, but this aspect is secondary for now.)
The reporting is reasonably straightforward for any single combination of User and Hierarchy; they want to see all the items they are interested in, listed in hierarchical sequence, totalled on change of level with the individual items M listed beneath the nodes of H. This is unfortunately required in real time, so retrieval performance is paramount.
Some statistics might help to determine the optimum approach:
The largest hierarchy has 10,000 nodes. The smallest about 100.
The largest would have 70% or more of its nodes unused at any point in time, and even the smallest would have 25% unused.
The hierarchies tend to be broad rather than deep, the maximum number of levels being about 5; but the larger ones should be twice as deep as this if performance was not compromised.
There are dozens of hierarchies, but it may be possible to sharply reduce this number by exploiting the Order Siblings By clause.
The number of rows in M varies between 500,000 and 50,000; depending upon how long historical data is retained on-line (and performance permitting, it would be retained indefinitely).
The number of users varies between 1000 and 2000 but the range of M in which they are interested varies greatly; from as few as 100 to as many as 10,000+. So it is almost always worth beginning by eliminating the items in which they are not interested, implying once again that the hierarchy should be traversed upwards rather than down from the root.
The current system is very old and survives by a tactic of building what are essentially materialised views of the database structure for each user overnight using, ahem, non-relational technology. This is inefficient and not easily scaled (but it works) and hence this redevelopment project needs to (a) work, and (b) work better and faster.
I am happy to provide some DDL scripts if that helps explain the problem better than this narrative.
I can't help feeling that the solution lies in somehow extending the hierarchical query past the many-to-many link table so that the Master list can be merged directly into the hierarchy such that the M items become the leaf nodes rather than the design outlined above - but I don't know how to do that. But I am sure everyone reading this does! :)
All advice appreciated. Database version is not an issue; we are currently using version 10XE for experimentation, but production usage could be on 11 if that contains helpful features.
Thank you
CSHi,
ChrisS. wrote:
I am happy to provide some DDL scripts if that helps explain the problem better than this narrative.Yes, please do.
The problem seems interesting, I'm sure many people here (including myself) are willing to help you in this matter.
So yes, post DDL for the tables, as well as INSERTs to populate them with representative data. Please also include the output you require along with detailed explanations about the logic to get it.
Don't forget to put lines of code between {code} tags in order to preserve formatting and readability, like this :
SELECT sysdate FROM dual;Thanks. -
How to design many to many relationship in the fact and dimension
There is a problem in my project what is the subject.And i wanna know how to implement in owb.I use the warehouse builder 10. Thanks.
You may design and load whatever db model you want to.
But If you set a unique key, you may find some integrity issues. I wouldn't do a many to many relationship between facts and dimensions. This could cause you lots of headaches when users start to submit queries using this tables. You'll probably face performance issues.
Regards,
Marcos -
Portal Form for a Many to Many relationship
I have 3 tables (well there are actually more but i'm glad when i can do the trick with 3 at the moment):
T_JOURNAL (JOURNAL_ID, JOURNAL_NAME)
T_CONTENTBROKER (CONTENTBROKER_ID, CONTENTBROKER_NAME)
HT_JOURNAL_CONTENTBROKER (JOURNAL_ID, CONTENTBROKER_ID)
The HT stants for 'help table'. T_JOURNAL and T_CONTENTBROKER have a many to many relationship. So one Journal can have many Broker and one Broker has many Journals.
When doing a Form in Oracle Portal for adding a new Journal, i'd like to have a LoV with the Brokers. But an new entry would at least require 3 tables to update (T_JOURNAL, T_CONTENTBROKER and the help table HT_JOURNAL_CONTENTBROKER). How can this be solved? i'm not very good with pl/sql... so if there is only a solution with pl/sql i would be glad for the code...
I also tried to create a view wich would show me the journal with all its broker but i kind of failed...
any suggestions appreciated ;)
- renatoThanks for the info. I tried that and it still doesn't pull the value. I have opened a TAR via metalink, but I'm not getting any
satisfactory answers. I ran across an note - 137172.1 that has this snippet of information in it.
Unfortunately, at this time (portal 3.0.7.6.2) , a non-table item cannot be
referenced in a plsql event handler, only in client side JavaScript code. This
is a known limitation and will be fixed in a future release.
I don't know how to get the value from the client side JavaScript code to a pl/sql variable. Do you?
I've been trying to get them to tell me if the 'known issue' has been addressed in 3.0.9.
I'll keep at it. Thanks so much for your suggestion I appreciate it.
Deb -
SSAS - Many to Many Relationship Grain Filters Out Data (Many to One)
I have a simple Many to One example: One Fact Table record has many Dimensional Items. The Example I'm using is One FactEvent record can have multiple EventMembers. These members are always unique so the relationship is really many to one (vs.
many to many). The grain of the Fact is one row for every event. Not all events have members, but I have stubbed those with -1
I tried using a Referenced dimensional relationship, but it threw my total counts off. I decided to make it more complicated by using a
Many to Many relationship, but I had issues once I started slicing the data.
The following are my two very simple tables:
FactEvents:
EventMemberID MemberKey EventMemberKey MemberName MemberGender
1 1 -1 None N
2 2 E2 Tyler M
3 3 E2 John M
4 4 E2 Sue F
5 5 E5 Tim M
6 6 E5 Jane F
7 7 E12 Ashley F
8 8 E12 Jessica F
9 9 E12 Kristy F
10 10 E17 Mike M
11 11 E17 Josh M
12 12 E18 Warren M
13 13 E18 Eric M
Here is the bridge Table:
EventID EventBK EventName EventMemberKey EventCount
1 E1 Hockey Game -1 1
2 E2 Soccer Game E2 1
3 E3 Baseball Game -1 1
4 E4 Concert -1 1
5 E5 Food Festival E5 1
6 E6 Movie Night -1 1
7 E7 Data Group Event -1 1
8 E8 City Tour -1 1
9 E9 Ski Trip -1 1
10 E10 Camping Trip -1 1
11 E11 Hiking Trip -1 1
12 E12 Community Cleanup E12 1
13 E13 Block Party -1 1
14 E14 Toastmasters -1 1
15 E15 Train Spotting -1 1
16 E16 Plane Spotting -1 1
17 E17 Fishing Trip E17 1
18 E18 Hunting Trip E18 1
19 E19 Street Hockey -1 1
20 E20 Bonspiel -1 1
You can see many events have no members and some events have multiple members. There is not separate members Dim, just the bridge table. I tried to build view that would work as bridge tables, but it started to feel like overkill.
Here is the SSAS structure:
Cube:
I tried creating a bridge Dim and Measure Group that can be used to join FactEvents with DimMemberEvent:
When I query the database tables directly, I can get the structure I'm looking for:
Gender Count
F 5
M 7
N 15
This represents that although there are 20 events, there were 5 Female and 7 Male participants and 15 events with No participants. When looking at the cube in excel I get:
Gender Count
F 3
M 4
N 15
Grand Total 20
The grand total is correct, however, it looks like it is grouping the events, so if there are multiple Female members at a particular event, they get rolled up. You can see this better if I pull in member name:
It includes all the names with count 1 ie. 5 Females with count 1, but the gender subtotal is 3 (as it is grouping the gender dimension)
The detail member counts are good, but the rolled up M and F counts are stripping out duplicates. Is there a way to model this in SSAS to preserve the detail member counts when the member dimension is used? Is a many to many the best solution?
This is all using SQL Server 2012 Multi-Dimensional Model. Thanks.Ok, for starters, if it's a one to many relationship, don't set it up as a many to many! Avoid many to many relationships and really anything other than "regular" relationships.
Second, the tables you pasted the data for aren't the tables you are describing them as, based on the dsv screenshot you included. If your post is confusing to the people who are wanting to help you, they will quickly move on.
It seems that you are not clear on how to construct a star schema. I will lay one out for you and hopefully this can help you on your journey.
fact_member_event:
event_id
member_id
member_event_count
dim_member:
member_id
member_key
member_name
member_gender
dim_event:
event_id
event_name
fact_event:
event_id
event_count
Or alternately, you could drop the fact_event fact table and have a calculated member that uses dimEvent.event.event.allmembers.count. It's a little bit of a weird situation that I would want to play with, but I would start with the above.
Also if you post back and show query results, you should make it clear what columns you are displaying. I see "count" in your query above, but nowhere in the star schema do I see "member count"
as a field.. I guess that's event count?
Hope this helps,
Ken -
WCF RIA entity Update from Lightswitch for Many to many relationship
I have two entities which have many to many relationship. I need to create a screen to update data from both the tables simultaneously using a screen. So I used First as a sql database entity in Lightswitch second is RIA service Entity(Which is junction table).
both tables are editable in a same screen but when I click on Save button,
System call to
[Query(IsDefault = true)]public IEnumerable<EquipmentJob> SelectFakeJobs()
method instead of calling
[Query]public IEnumerable<EquipmentJob> SelectJobs(long? ID).
I am using the Ria table as a query in my screen and setting the parameter as a table1.SelectedItem.ID. But after click on save it does not call to parameterized
method to get data. I have already implemented the 'Saving' method. It gives following exception.
Only changes to a single data service can be saved. To save changes to multiple data services, implement the "Saving" method.
Data conflict. another user has deleted the record.
I followed following link to setup the Many to Many relationship update in LightSwitch
http://powerbala.com/many-to-many-control-for-microsoft-lightswitch/Only changes to a single data service can be saved. To save changes to multiple data services, implement the "Saving" method.
This issue is discussed before, generally you need implement the <ScreenName>_InitializeDataWorkspace method and add the data services that you'd like to save to the saveChangesTo list.
https://social.msdn.microsoft.com/Forums/en-US/238e5e91-8598-42f9-817d-12b6f5b980a1/having-a-problem-saving-getting-error?forum=lightswitch -
Need example of adding attributes for many-to-many relationship
Hi,
Looking for examples of mappings and update code for many-to-many relationships with attributes.
There is a doc in Metalink:206971.1 that says that it can be done but no examples are shown.
Would realllly appreciate any help you can provide.
Cheers,
NimExtended Many to Many Question
Really there isn't any code to show. The recommendation is to create a class to represent the relationship. See link above for more details on the issue.
- Don -
Siebel BI Publisher Report having many-to-many relationship
I have query on creating BI publisher reports having many to many relations. The report requirements has fields from entities Customer, Claims and Payments. For explanation let say fields are customer name, claim ref, payment amount, pay id. claims and Payments entity has many to many relationship. Now my report shows as below. Actual Total Amount Paid to customer is 11,500. However my report total is shown as 13,000. How to resolve this ?
Customer Name Claim Ref Payment Amt Pay Id
Mr XYZ 1001 10,000 1-101
Mr XYZ 1001 1500 1-102
Mr XYZ 1002 1500 1-102
I was thinking about a solution of having two columns side by side within a page. Column left will the show the data Customer to Claims and Column right will show the data Customer to Payments. But not sure how to achieve the rows wise alignment for the new customer records between two columns. If row wise alignment achieved then hope workaround might be accepted by client. Any help in this is greatly appreciatedThanks for the reply. The many to many relationship between Claims and Payments are achieved through intersection table in siebel. When Customer has multiple claims, single payment issued for both claims. Also single claim can multiple payments such (part compensation, interests, final compensation etc)
-
Many to Many Relationship using junction table..
Hello im testing a many to many relation ship on j2ee and found this issue.
Creating a relation ship table until now without succes to update the relationship table:
code fragment as is:
On application flow my session bean call the following method according with the specification i have no reason to call persist in my writer just on parent Object: Any clue on what is wrong ?
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void saveWriter (Book book , Writer writer){
try {
Book atBook = entityManager.merge(book);
Writer atWriter = entityManager.merge(writer);
book.getWriters().add(atWriter);
entityManager.persist(atBook);
entityManager.flush();
}catch (Exception ex)
ex.printStackTrace();
<entity class="com.octech.biblio.domain.Book" name="book">
<description></description>
<table name="books" />
<attributes>
<id name="id">
<generated-value strategy="IDENTITY"/>
</id>
<basic fetch="EAGER" name="bookName">
<column insertable="true" length="128" name="bookname" table="" updatable="true"/>
</basic>
<many-to-one name="Library" fetch="LAZY" target-entity="com.octech.biblio.domain.Library">
<join-table name="library_books">
<join-column name="books_id"/>
<inverse-join-column name="library_id"/>
</join-table>
<cascade/>
</many-to-one>
<many-to-many name="Writers" fetch="LAZY" target-entity="com.octech.biblio.domain.Writer">
<join-table name="writers_books">
<join-column name="books_id"/>
<inverse-join-column name="writer_id"/>
</join-table>
<cascade/>
</many-to-many>
</attributes>
</entity>
<entity class="com.octech.biblio.domain.Writer" name="writer">
<description></description>
<table name="writers" />
<attributes>
<id name="id">
<generated-value strategy="IDENTITY"/>
</id>
<basic fetch="EAGER" name="writerName">
<column insertable="true" length="128" name="writer_name" table="" updatable="true"/>
</basic>
<many-to-many name="Books" fetch="LAZY" target-entity="com.octech.biblio.domain.Book">
<join-table name="writers_books">
<join-column name="writer_id"/>
<inverse-join-column name="books_id"/>
</join-table>
<cascade/>
</many-to-many>
</attributes>
</entity>sybrand_b wrote:
The way you write it yes, but there is one minor detail.
You can have a 0,1 or many relationship: one employee has zero, one or many phone numbers
but you can not have the opposite, as it doesn't make sense.
0, 1 or many phone numbers belong to 1 employee.
It is customary to use 0,1 or m when the relationship is optional.
Sybrand Bakker
Senior Oracle DBAIs this correct now ?
one to many : one employee has 0,1 or multiple phone numbers
many to one : 1 or multiple phone numbers to one employee -
Many-to-many relationship in LDAP ,OID
I would like to know if there is a way to implement a many-to-many relationship in OID. We have two tables which are linked by many-to-many relationship and we would like to maintain the same structure on OID? Any hint , code would be greatly appreciated.
Thanks for your help.
SuhailYes possible.
You can use lookup task to compare and get reference values.
You can also use T-SQL scripts itself using OUTPUT clause inside Execute SQL task
Can you elaborate on your exact scenario so that we can suggest as per your specific need?
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
While understanding the limitation of having both a child and parent both be updatable, I am having trouble getting the child (read only mapping) to retrieve the appropriate objects??? is there some trick to get this to happen? the writable mapping is able to retrieve them, but the read only one just doesn't populate?
Thanks,
MichaelOk, I think I am closer to the real issue... your example provides a fremework that functions as it should.
However, what I am doing is:
(FYI: My parents can update their children in the M-M mapping)
1. Copying a child object using a copy constructor.
The constructor retains all existing relationships to it's parent and children (both many to many) by looping through them and calling the setParent and setChild appropriate methods that you recommended.
...this works properly
2. Then I assign a new (already persisted) Parent object to the newly created child. When I persist the child, I get the following error after fully validating the uow:
Exception occured: LOCAL EXCEPTION STACK:
EXCEPTION [TOPLINK-7056] (TopLink - 9.0.3.2 (Build 429)): oracle.toplink.exceptions.ValidationException
EXCEPTION DESCRIPTION: The wrong object was registered into the UnitOfWork. The object [com.wachovia.retail.dal.business.loanreview.Element@9815354] should be the object from the parent cache
Can you explain why this is happening?
FYI, if I attempt to assign a new (already persisted) child, it works fine. -
Many to Many Relationships in ejb.....Urgent Pls help
hi all,
Am working in EJB.Now we are coding for many to many relationship.
Company and Salary register
One Company can have many salary register and More than one company can have one salary register
Companyand Salary register are the two tables having details of it.And the intermediate table having pk of company and salary register is Company_salary_register table,I want to add the value in this table having seperate interface.
How to model it? I have given the add method of this company_salary_register table in company bean.I am getting the value of this one as collection.But it is asking me to add the values as the instance of LocalSalary(interfaceand entitybean).If i type cast it as Local Salary Class castexception occurs
Please help me.Even Material of Modelling Many to Many relationship in EJB is enough.
thanx in advance,THaaaaaanks alottt for the quick reply...
I used the first way to insert the document and i was successful...
but thing is that..
when i do
SQL>desc message_type
message_type is NOT FINAL
Name Null? Type
SYS_XDBPD$ XDB.XDB$RAW_LIST_T
to VARCHAR2(4000 CHAR)
from VARCHAR2(4000 CHAR)
subject VARCHAR2(4000 CHAR)
body VARCHAR2(4000 CHAR)
i can see the structure...
and when i
select count(*) from messages
it says count is 1.
so how to know where the data is ..like below in the data :
'to' it has '[email protected]'
and for 'from' it has '[email protected]'..and so on..
<message>
<to>[email protected]</to>
<from>[email protected]</from>
<subject>Question</subject>
<body>Does this demo work?</body>
</message>
so what is the command to get that data...
because when i do
select * from message_type..it says
select * from message_type
ERROR at line 1:
ORA-04044: procedure, function, package, or type is not allowed here
Plss help me outt.......this will be my final step...
Thankssssssssssssssss -
Creating data in a many-to-many-relationship
Hello,
we really have problems in implementing a JClient dialog based on BC4J for creating data in a many to many relationship - especially with cascade delete on both sides.
Simplified our tables look like:
create table A_TABLE
A_ID VARCHAR2(5) not null,
A_NAME VARCHAR2(30) not null,
constraint PK_A_TABLE primary key (A_ID),
constraint UK_A_TABLE unique (A_NAME)
create table B_TABLE
B_ID VARCHAR2(5) not null,
B_NAME VARCHAR2(30) not null,
constraint PK_B_TABLE primary key (B_ID),
constraint UK_B_TABLE unique (B_NAME)
create table AB_TABLE
A_ID VARCHAR2(5) not null,
B_ID VARCHAR2(5) not null,
constraint PK_AB_TABLE primary key (A_ID, B_ID),
constraint FK_AB_A foreign key (A_ID) references A_TABLE (A_ID) on delete cascade,
constraint FK_AB_B foreign key (B_ID) references B_TABLE (B_ID) on delete cascade
Could JDev Team please provide a BC4J/JClient sample that performs the following task:
The dialog should use A_TABLE as master and AB_TABLE as detail. The detail displays the names associated with the IDs. Next to AB_TABLE should be a view of B_TABLE which only displays rows that are currently not in AB_TABLE. Two buttons are used for adding and removing rows in AB_TABLE. After adding or removing rows in the intersection the B_TABLE view should be updated. The whole thing should work in the middle and client tier. This means no database round trips after each add/remove, no posts for AB_TABLE and no query reexecution for B_TABLE until commit/rollback.
This is a very common szenario: For an item group (A_TABLE) one can select and deselect items (AB_TABLE) from a list of available items (B_TABLE). Most of JDeveloper4s wizards use this. They can handle multi/single selections, selections from complex structures like trees and so on. Ok, the wizards are not based on BC4J - or? How can we do it with BC4J?
Our main problems are:
1. Updating the view of B_TABLE after add/remove reflecting the current selection
2. A good strategy for displaying the names instead of the IDs (subqueries or joining the three tables)
3. A JBO-27101 DeadEntityAccessException when removing an existing row from AB_TABLE and adding it again
Other problems:
4. We get a JBO-25030 InvalidOwnerException when creating a row in AB_TABLE. This is caused by the composition. We workaround this using createAndInitRow(AttributeList) on the view object (instead of create()). This is our add-Action:
ViewObject abVO = panelBinding.getApplicationModule().findViewObject("ABView");
ViewObject bVO = panelBinding.getApplicationModule().findViewObject("BView");
Row bRow = bVO.getCurrentRow();
NameValuePairs attribList = new NameValuePairs(
new String[]{"BId"}, new Object[]{bRow.getAttribute("BId")});
Row newRow = abVO.createAndInitRow(attribList);
abVO.insertRow(newRow);
5. After inserting the new row the NavigationBar has enabled commit/rollback buttons and AB_TABLE displays the row. But performing a commit does nothing. With the following statement after insertRow(newRow) the new row is created in the database:
newRow.setAttribute("BId", bRow.getAttribute("BId"));
Please give us some help on this subject.
Best regards
Michael Thal<Another attempt to post a reply. >
Could JDev Team please provide a BC4J/JClient sample
that performs the following task:
The dialog should use A_TABLE as master and AB_TABLE
as detail. The detail displays the names associated
with the IDs. Next to AB_TABLE should be a view of
B_TABLE which only displays rows that are currently
not in AB_TABLE. Two buttons are used for adding and
removing rows in AB_TABLE. After adding or removing
rows in the intersection the B_TABLE view should be
updated. The whole thing should work in the middle
and client tier. This means no database round trips
after each add/remove, no posts for AB_TABLE and no
query reexecution for B_TABLE until commit/rollback.
This is a very common szenario: For an item group
(A_TABLE) one can select and deselect items
(AB_TABLE) from a list of available items (B_TABLE).
Most of JDeveloper4s wizards use this. They can
handle multi/single selections, selections from
complex structures like trees and so on. Ok, the
wizards are not based on BC4J - or? How can we do it
with BC4J?
Our main problems are:
1. Updating the view of B_TABLE after add/remove
reflecting the current selectionYou should be able to use insertRow() to insert the row into proper collection.
However to remove a row only from the collection, you need to add a method on the VO subclasses (and perhaps export this method so that the client side should see it) to unlink a row from a collection (but not remove the associated entities from the cache).
This new method should use ViewRowSetImpl.removeRowAt() method to remove the row entry at the given index from it's collection. Note that this is an absolute index and not a range index in the collection.
2. A good strategy for displaying the names instead
of the IDs (subqueries or joining the three tables)You should join the three tables by using reference (and perhaps readonly) entities.
3. A JBO-27101 DeadEntityAccessException when
removing an existing row from AB_TABLE and adding it
againThis is happening due to remove() method on the Row which is marking the row as removed. Attempts to add this row into another collection will throw a DeadEntityAccessException.
You may 'remove the row from it's collection, then call 'Row.refresh' on it to revert the entity back to undeleted state.
>
Other problems:
4. We get a JBO-25030 InvalidOwnerException when
creating a row in AB_TABLE. This is caused by the
composition. We workaround this using
createAndInitRow(AttributeList) on the view object
(instead of create()). This is our add-Action:
ViewObject abVO =
O =
panelBinding.getApplicationModule().findViewObject("AB
iew");
ViewObject bVO =
O =
panelBinding.getApplicationModule().findViewObject("BV
ew");
Row bRow = bVO.getCurrentRow();
NameValuePairs attribList = new NameValuePairs(
new String[]{"BId"}, new
String[]{"BId"}, new
Object[]{bRow.getAttribute("BId")});
Row newRow = abVO.createAndInitRow(attribList);
abVO.insertRow(newRow);This is a handy approach. Note that Bc4j framework does not support dual composition where the same detail can be owned by two or more masters. In those cases, you also need to implement post ordering to post the masters before the detail (and reverse ordering for deletes).
>
5. After inserting the new row the NavigationBar has
enabled commit/rollback buttons and AB_TABLE displays
the row. But performing a commit does nothing. With
the following statement after insertRow(newRow) the
new row is created in the database:
newRow.setAttribute("BId",
d", bRow.getAttribute("BId"));This bug in JDev 903 was fixed and a patch set (9.0.3.1) is (I believe) available now via MetaLink.
>
>
Please give us some help on this subject.
Best regards
Michael Thal
Maybe you are looking for
-
Remote Desktop Gateway 2008 R2 - logon attempt failed
I've already read through a lot of threads regarding this. Our RDGW has been working for approx 2 years. Suddenly now, some clients start to get the "logon attempt failed" when they are using rdgw. It does seems to be an increasing problem.. - Redire
-
Can I save a single image as several file names in one go.
I know this sounds like an unsual question, but I want to take an image (say a logo) and save that image multiple times (could be 1000 times), but each time as a different file name. ( I have a commercial reason why I dont want that image to be named
-
SAP Business One Interface.
Hi everybody, I'm new in SAP Business One. We are working with other third to party warehouse management software, and we have to create an interface with it. The warehouse system works with tables in its own data base, where we have to put the sales
-
ABAP WD: Editable Table - Identifying changed cells
Hi, I have a requirement to create editable table. I have been successful in doing so. However, I have the following requirement. 1) In case the user changes a particular column in a particular row, how will I get to know only that particular row/col
-
Regarding the re-display of the path of an Upload File.
Is there a way to re-display the path of the Upload File? I have browse this on the internet and they say that the browser itself prohibits this for security reasons. (Please correct me if I'm wrong) Please help. Thanks in advance!