Weak/Soft/Phantom/Circular references
Hi,
Could you please explain the below with example?
Weak/Soft/Phantom/Circular references in java and when It should be used in what situations? What are the pros and cons?
Please clarify.
Thanks.
What part of the Javadoc didn't you understand?
BTW circular references do not belong with the others. A doubly linked list is an example of a set of circular references: there is a chain of references that leads back to the starting point. This is also known as a cyclic graph.
Similar Messages
-
Phantom circular reference errors in spreadsheet
I'm getting phantom circular reference errors in one of my Appleworks spreadsheets.
I'm trying to compute the average of several sets of pairs of numbers, I have max of three pairs per line, and I'm using COUNT to determine how many pairs are present. I'm getting "can't resolve circular reference" errors occasionally when I fill down and add data for a new line, even though there aren't any circular references.
Columns
A= date, B=average X, C=averageY, D=number of pairs for this line
E F = first pair, G H = second pair, I J = third pair.
The second and third pair don't occur every day.
These are the formulas I'm using,
B average_X =(E_line# + G_line# + Iline#)/Dline#
C average_Y =(F_line# + H_line# + Jline#)/Dline#
D numPairs =COUNT(Eline#...Jline#)/2
I add a new line each day.
Its worked just fine until I went over 100 lines and now I occasionally get "can't resolve circular reference" erros, and the calculation cells, but there AREN'T any circular references.
Anyone have any idea whats going on?I'm using AW 6.2.7 I'm on OS X 10.3.9
I tried it with removing the AVERAGE and COUNT functions and it still happens.
Seems like its somehow related to any references to columns J and K, even if there's no data in those cells, and no references to other cells.
Its related to the COUNT function.
If I drop off the last two columns it all seems to work ok.
=(F153+H153)/(E153/2)
where E153 is =COUNT(F153..I153)
But if I try to use the last pair (columns J and K) it gets errors
=(F153H153I153)/(E153/2)
where E153 is =COUNT(F153..K153)
DOES the COUNT function have a limitation to how many cells it can reference?
It seems like for some reason the J column is corrupted. sometimes if there is any number in colum J it gets "circular reference error" EVEN though there is NO circulare reference only a number.
BUT when I delete the number from Column J the error goes away. -
How to check circular reference in data of millions of rows
Hi all,
I am new as an oracle developer.
I have a table(say table1) of hierarchical data with columns child_id and parent_id. The table has around 0.5 million records. There are around 0.2 million root level records are present.
I need to update some (the number variies on different conditions, might differ from 50K to 0.4 million) of the parent_ids from other table only if that do not cause any circular reference in data of table1.
I am using Oracle9i.
The approach I have tried is:
I copied all data from table1 to a work table table3. Update the parent_id on columns that matches the condition and updated a column source_table to table2.
I copied all the child_id from table2 that are to be updated into another table table4 and built tree for each of those childs. If it builds the tree successfully updated a column is_circular in the table3 to 0 and then deleted the child_id from table4.
This whole process needs to run recursively until no tree is built successfully in an iteration.
But this process is running slow and at the rate it is executing it would run for days for the 0.3 million records.
Please suggest a better way to do this.
The code I am using is :
INSERT /*+ append parallel (target,5) */
INTO table3 target
select /*+ parallel (src,5) */
child_id, parent_id, 'table1' source_table,null
from table1 src;
INSERT INTO table4
select distinct child_id, parent_id
from table2
where status_cd is null;
commit;
Update dtable3 a
set (parent_id,source_table) = (select parent_id,'table2' source_table
from table4 b
where b.child_id = a.child_id);
WHILE v_loop_limit<>v_new_count
LOOP
select count(1)
into v_loop_limit
from table4;
-+-----------------------------------------------------------
--| You need to actually traverse the tree in order to
--| detect circular dependencies.
+-----------------------------------------------------------
For i in 1 .. v_new_count
BEGIN
select child_id
into v_child_id from(
select child_id, row_number() over (order by child_id) pri from table4)
where pri = i;
SELECT COUNT (*) cnt
INTO v_cnt
FROM table3 dl
START WITH dl.child_id = v_child_id
CONNECT BY PRIOR dl.child_id = dl.parent_id ;
UPDATE table3SET is_circular = '0'
where child_id= v_child_id
and source_table = 'table2';
delete from table3
where child_id = v_child_id;
select count(1)
into v_new_count
from table4;
COMMIT;
EXCEPTION WHEN e_infinite_loop
THEN dbms_output.put_line ('Loop detected!'||v_child_id);
WHEN OTHERS THEN
dbms_output.put_line ('Other Exceptions!');
END;
END LOOP;
END LOOP;
Thanks & Regards,
RuchiraHello,
First off, if you're so new to a technology why do you brush off the first thing an experienced, recognized "guru" tells you? Take out that WHEN OTHERS ! It is a bug in your code, period.
Secondly, here is some code to try. Notice that the result depends on what order you do the updates, that's why I run the same code twice but in ASCENDING or DESCENDING order. You can get a circular reference from a PAIR of updates, and whichever comes second is the "bad" one.drop table tab1;
create table TAB1(PARENT_ID number, CHILD_ID number);
create index I1 on TAB1(CHILD_ID);
create index I2 on TAB1(PARENT_ID);
drop table tab2;
create table TAB2(PARENT_NEW number, CHILD_ID number);
insert into TAB1 values (1,2);
insert into TAB1 values (1,3);
insert into tab1 values (2,4);
insert into TAB1 values (3,5);
commit;
insert into TAB2 values(4,3);
insert into TAB2 values(3,2);
commit;
begin
for REC in (select * from TAB2 order by child_id ASC) LOOP
merge into TAB1 O
using (select rec.child_id child_id, rec.parent_new parent_new from dual) n
on (O.CHILD_ID = N.CHILD_ID)
when matched then update set PARENT_ID = PARENT_NEW
where (select COUNT(*) from TAB1
where PARENT_ID = n.CHILD_ID
start with CHILD_ID = n.PARENT_NEW
connect by CHILD_ID = prior PARENT_ID
and prior PARENT_ID <> n.CHILD_ID) = 0;
end LOOP;
end;
select distinct * from TAB1
connect by PARENT_ID = prior CHILD_ID
order by 1, 2;
rollback;
begin
for REC in (select * from TAB2 order by child_id DESC) LOOP
merge into TAB1 O
using (select rec.child_id child_id, rec.parent_new parent_new from dual) n
on (O.CHILD_ID = N.CHILD_ID)
when matched then update set PARENT_ID = PARENT_NEW
where (select COUNT(*) from TAB1
where PARENT_ID = n.CHILD_ID
start with CHILD_ID = n.PARENT_NEW
connect by CHILD_ID = prior PARENT_ID
and prior PARENT_ID <> n.CHILD_ID) = 0;
end LOOP;
end;
select distinct * from TAB1
connect by PARENT_ID = prior CHILD_ID
order by 1, 2;One last thing, be sure and have indexes on child_id and parent_id in your main table! -
Circular reference detected while serializing
I have been trying hard to get this resolved this, but haven't reached to any conclusion.
Here is my situation.
I have two entities called Parent and Child, where parent has a refernce to many child and child has one parent so inturn there is OneToMany(Bidirectional) relationship between them. When i expose this as a webservice I get the following exception :
<faultstring>Internal Server Error (circular reference detected while serializing: com.thoughtclicks.Parent)</faultstring>
This error occurs incase i expose the service as Document/Literal, incase i expose this service as RPC Encoded then this exception doesn�t occurs and everything is fine, but Axis2 doesn;t support client generation for RPC/Encoded so again a problem.
Also, I have already tried putting @XMLTransient annotation on getChild() of the Parent class, but it doesn�t help and i continue getting the same error.
Let me know if there is a work around for this solution.
Any pointers are highly appreciated.
Thanks,
RahulHello,
You might want to post this in the JDev/ADF forum, as it is not related to TopLink/JPA. The error seems to indicate that you are getting the problem because it is finding Location has a reference to an association that has a reference back to the same location, causing a problem when creating the copies for serialization. I am not familar with this problem, but there is likely a way to mark one of these references as transient to the serialization process so that it is no longer a loop - yet can still be used in your object model and in JPA. Something like @XmlTransient for JAXB.
Best Regards,
Chris -
JPA: mapping circular references
Hi all,
I'm trying to map a simple parent-to-children-knows-parent scenario, which contains circular references, using JPA annotations. Here is the current code:
@Entity
public class Assortment implements Identifiable {
@Id
@GeneratedValue
private long id;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent")
private Set<Assortment> subAssortments = new HashSet<Assortment>();
@ManyToOne(fetch = FetchType.LAZY)
private Assortment parent = null;
}The DDL for the table is the following:
CREATE TABLE ASSORTMENT (ID BIGINT PRIMARY KEY, CODE VARCHAR(5) NOT NULL, NAME VARCHAR(50) NOT NULL, STATUS TINYINT NOT NULL, PARENT_ID BIGINT, CONSTRAINT FK_ASMT_PARENT FOREIGN KEY (PARENT_ID) REFERENCES ASSORTMENT(ID));When creating a basic tree (one root to which two children were added) and persisting this object using a simple entityManager.persist(root) call, I get the following (shortened) exception:
org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.exception.ConstraintViolationException: could not insert: [core.model.goods.Assortment]; nested exception is javax.persistence.EntityExistsException: org.hibernate.exception.ConstraintViolationException: could not insert: [core.model.goods.Assortment]
Caused by: javax.persistence.EntityExistsException: org.hibernate.exception.ConstraintViolationException: could not insert: [core.model.goods.Assortment]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:555)
Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [core.model.goods.Assortment]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
Caused by: java.sql.SQLException: Attempt to insert null into a non-nullable column: column: ID table: ASSORTMENT in statement [insert into Assortment (id, code, name, status, parent_id) values (null, ?, ?, ?, ?)]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
...It looks like the Hibernate EntityManager (the JPA implementation) is trying to insert a null value in the table's primary key (id). This understandable, since saving an object requires first knowing what the parent's ID is - although here the root has no parent and hence the parent's ID must be null.
How must I adapt my code to handle this particular scenario? Are my annotations correct? Should I change the data structure definition instead?
Thanks a lot,
GBTwo things:
First, the Assortment.parent attribute needed to be annotated with @JoinColumn(name="parent_id")Second, the SQL query sent by Hibernate used an HSQLDB specificity, the identity column, to generate the primary key. By setting hibernate.hbm2ddl.auto=true in my persistence.xml file and setting the log level to debug, I could see that the table was generated using this (approximate) statement:
CREATE TABLE ASSORTMENT (ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, CODE VARCHAR(5), NAME VARCHAR(50), STATUS TINYINT NOT NULL, PARENT_ID BIGINT, CONSTRAINT FK_ASMT_PARENT FOREIGN KEY (PARENT_ID) REFERENCES ASSORTMENT(ID))The "GENERATED BY DEFAULT AS IDENTITY" seems to be the key here.
Hope this helps someone out there.
Cheers,
GB -
Weak and Strongly Typed Reference Cursors in Reports
Our custom reports has been using a reference cursor. I have inherited the code and not sure why there is a need to use a reference cursor when it can be done by a simple select statements. I see no dynamic select statements passed or any special parameters to reason out for use of reference cursor in our custom reports. Prior developers had reason out the benefits of using reference cursor for performance. I tested this by running a report with reference cursor versus plain select statement and still the report that is using the plain select statement performed better (faster) than the report that has the reference cursor, there is a big difference.
I have seen some disadvantage of using reference cursor on the reports that when there is a database object change even if the package that sourced the reference cursor has not been updated or modified the reports needs to be recompiled each time we get this error message coming from the report server queue:
Terminated with error: <br>REP-8: Run time error in the PL/SQL development
environment (DE). PDE-PSD001 Could not resolve reference to <Unknown Program Unit>
while loading <Unknown> <Unknown>. REP-0008: Unexpected memory error while
initializing preferences.In 9iAS reports prior version the error is occurring rarely. When we moved to 10.1.2.2.0 reports it appears the error occurs most often. We have made an effort to research about the issue and appears to be a bug. One suggestion is to use a strongly typed reference cursor. I have tried to researched about the difference between a weak and strongly typed reference cursor but failed to understand them. I appreciate any help about examples differentiating a weak versus a strongly typed reference cursors.
Thanks,
WarrenI guess my point, for what it's worth, is that whether you use only a strongly typed REF CURSOR, or whether you also use a weakly typed REF CURSOR, you may still end up getting the REP-0008 error (at least if your report is in .REP format). You can avoid this by using a pipelined function instead (or by putting the SQL directly in the report, or possibly by using .RDF or .JSP format).
To test this, you might:
1. Create a database package with an SQL*Plus script that that looks something like this:
CREATE OR REPLACE PACKAGE TEST AS
TYPE RECORD_TYPE IS RECORD
USERNAME ALL_USERS.USERNAME%TYPE
TYPE TABLE_TYPE IS TABLE OF RECORD_TYPE;
TYPE WEAKLY_TYPED_REF_CURSOR_TYPE IS REF CURSOR;
TYPE STRONGLY_TYPED_REF_CURSOR_TYPE IS REF CURSOR RETURN RECORD_TYPE;
FUNCTION GET_WEAKLY_TYPED_REF_CURSOR RETURN WEAKLY_TYPED_REF_CURSOR_TYPE;
FUNCTION GET_STRONGLY_TYPED_REF_CURSOR RETURN STRONGLY_TYPED_REF_CURSOR_TYPE;
FUNCTION GET_PIPELINED_TABLE RETURN TABLE_TYPE PIPELINED;
END TEST;
CREATE OR REPLACE PACKAGE BODY TEST AS
FUNCTION GET_WEAKLY_TYPED_REF_CURSOR RETURN WEAKLY_TYPED_REF_CURSOR_TYPE
IS
cWeaklyTypedRefCursor WEAKLY_TYPED_REF_CURSOR_TYPE;
BEGIN
OPEN cWeaklyTypedRefCursor FOR
SELECT USERNAME FROM ALL_USERS;
RETURN cWeaklyTypedRefCursor;
END GET_WEAKLY_TYPED_REF_CURSOR;
FUNCTION GET_STRONGLY_TYPED_REF_CURSOR RETURN STRONGLY_TYPED_REF_CURSOR_TYPE
IS
cStronglyyTypedRefCursor WEAKLY_TYPED_REF_CURSOR_TYPE;
BEGIN
OPEN cStronglyyTypedRefCursor FOR
SELECT USERNAME FROM ALL_USERS;
RETURN cStronglyyTypedRefCursor;
END GET_STRONGLY_TYPED_REF_CURSOR;
FUNCTION GET_PIPELINED_TABLE
RETURN TABLE_TYPE PIPELINED
IS
BEGIN
FOR rec IN
SELECT USERNAME FROM ALL_USERS
LOOP
PIPE ROW(rec);
END LOOP;
END GET_PIPELINED_TABLE;
END TEST;
/2. Create a report based on REF CURSOR query using only a strongly typed REF CURSOR. The PL/SQL statement that you use in the report as the data source for the query might look something like this:
function QR_1RefCurDS return test.strongly_typed_ref_cursor_type is
begin
return test.get_strongly_typed_ref_cursor;
end;3. Compile the report to a .REP file and run it to make sure it works as expected.
4. Drop and re-create the TEST package in the database.
5. Try running the .REP file again. I expect you will get the REP-0008 error.
6. Modify the REF CURSOR query to use an underlying weakly typed REF CURSOR by changing the PL/SQL statement (from Step 2) to something like this:
function QR_1RefCurDS return test.strongly_typed_ref_cursor_type is
begin
return test.get_weakly_typed_ref_cursor;
end;7. Repeat Steps 3 through 5. I expect you will get the REP-0008 error again.
8. Replace the REF CURSOR query in report with an SQL query that looks something like this:
SELECT * FROM TABLE(TEST.GET_PIPELINED_TABLE)9. Repeat Steps 3 through 5. I expect you will not get the REP-0008 error.
Hope this helps. -
Revision: 10029
Author: [email protected]
Date: 2009-09-04 11:57:34 -0700 (Fri, 04 Sep 2009)
Log Message:
Revert change 9940 for BLZ-429 which broke circular references, need to take another look.
Ticket Links:
http://bugs.adobe.com/jira/browse/BLZ-429
Modified Paths:
blazeds/trunk/modules/core/src/flex/messaging/io/amf/AbstractAmfInput.java
blazeds/trunk/modules/core/src/flex/messaging/io/amf/Amf0Input.java
blazeds/trunk/modules/core/src/flex/messaging/io/amf/Amf3Input.java -
Hi All,
I have implemented a VPD and added policies to Table_A and Table_B.
The policy function of Table_A returns a predicate like this: EXISTS (SELECT 1 FROM TABLE_B WHERE TABLE_B.COLUMN_1 = TABLE_A.COLUMN_1)
And the policy function of Table_B returns a predicate like this: EXISTS (SELECT 1 FROM USER_POSSIBLE_VALUES WHERE USER_POSSIBLE_VALUES.USER = sys_context('ctxA','user') AND USER_POSSIBLE_VALUES.CD_VALUE = TABLE_B.CD_VALUE)
So, when I make a query on Table_A, its policy activates Table_B policy and it filters the result.
And when I make a query on Table_B, its own policy filters the result.
The problem is that I had to change the predicate of table_B policy and put a reference to table_A in it, and now I have a problem of circular reference.
I need this reference to table_A in Table_B policy. Is there a way to prevent Table_A policy from being activated when Table_A is used inside Table_B policy?
I dont want to drop the policy, I just want to bypass Table_A policy when used in Table_B policy.
I'm using Oracle 9i.
Thank you!We ran into the same issues. Basically you need to design policies that depend only on columns in the table the policy is written against, on contexts, and/or on global variables (package spec variables) or you can run into the issue where the filter condition depends on a table with a policy that is already in the chain of table policies involved in the query when you use queries on other tables in the policy. Unless the target table of the policy is pretty much not involved in joins to any of the tables you are restricting via policies.
We managed to replace a detail table with a view that did the filtering of the detail rows based on the join condition to the header which was filtered by a polciy. That is, if you eliminate the header rows via a policy and then join to the detail you have probably already filted the detail rows since detail rows will not be returned to header rows that have already been filtered out of the query.
HTH -- Mark D Powell -- -
Hi all,
In a Check payment PLD, when I am create new formula field when I am adding formula Concat(F_196,ToString(Field_150))
Its shows Circular reference have been detected ,Document may not print correctly .
pl suggest me
Thanks
NitinHi Sir,
Thank You very much.
Regards
Nitin -
Circular reference calling the ImportFileGeneratorTask java class
Hello,
I am facing an issue when I generate in my build.xml the import file with the ImportFileGeneratorTask java class:
Unable to sort files due to circular reference: ROLE-R_ALL_G_T_USER.xml -> ROLE-BR_ALL_G_T_USER.xml -> ROLE-R_ALL_G_T_USER.xmlIt occurs in the ObjectDependencySort java class because a Business Role contains an IT Role.
Here is an extract of my build.xml:
<taskdef name='generateImportFile' classname='com.sun.idm.ide.cbe.ImportFileGeneratorTask'>
<classpath>
<fileset dir="tools">
<include name="idmcbetasks.jar" />
</fileset>
<pathelement path="${CLASSPATH}" />
</classpath>
</taskdef>
<generateImportFile outputFile='${basedir}/${import.file.generated}' incremental='${import.file.incremental}' updateTrackerFile='${import.file.update.tracker}'>
<fileset dir='${custom-filtered-config-dir}'
includes='${xml-autogen-import-includes}'
excludes='${xml-autogen-import-excludes}'/>
<filtermapper>
<replacestring from='\' to='/'/>
<replaceregex pattern='.*/${custom-filtered-config-dir}/(.*)' replace='WEB-INF/config/\1'/>
</filtermapper>
</generateImportFile>Does anyone already been confronted to this issue?
Thanks,
Nicolasyou can just get rid of the ParentRoles tag in every Role. This does make the circular reference to disappear and roles are still contained in each other correctly as far as I tested it.
-
Circular reference during serialization error
I am getting the following error when invoking an operation on my web service that returns a 'Make' object:
ERROR OWS-04046 circular reference detected while serializing: com.edmunds.vehicle.definition.Make circular reference detected while serializing: com.edmunds.vehicle.definition.Make
I am running oc4j-101310.
I can successfully call a 'createMake' operation as it returns 'void' so i know the WS is deployed correctly. The only values I am using to create the make are "Make.name" & "Manufacturer.name" so there isn't much to it. I know there are object graphs with 'models' and a parent reference to 'Manufacturer so I don't know if this has anything to do with it.
One weird thing is that this worked the first time i deployed it but then started breaking on subsequent re-deployments (maybe I'm smoking crack)...
Any help is appreciated!!
Make object:
public class Make implements Serializable {
private Long id;
private Set models;
private String name;
private Manufacturer manufacturer;
public Set getModels() {
return models;
public void setModels(Set models) {
this.models = models;
public void setName(String name) {
this.name = name;
public String getName() {
return name;
public void setManufacturer(Manufacturer manufacturer) {
this.manufacturer = manufacturer;
public Manufacturer getManufacturer() {
return manufacturer;
public void setId(Long id) {
this.id = id;
public Long getId() {
return id;
Here is the SOAP request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.matchbox.edmunds.com/">
<soapenv:Header/>
<soapenv:Body>
<ws:findMakeElement>
<ws:Long_1>22</ws:Long_1>
</ws:findMakeElement>
</soapenv:Body>
</soapenv:Envelope>
Here is the SOAP response:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://ws.matchbox.edmunds.com/" xmlns:ns1="http://definition.vehicle.edmunds.com/" xmlns:ns2="http://www.oracle.com/webservices/internal/literal" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>Internal Server Error (circular reference detected while serializing: com.edmunds.vehicle.definition.Make)</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
Here is my WSDL:
<?xml version="1.0" encoding="UTF-8" ?>
<definitions
name="VehicleService"
targetNamespace="http://ws.matchbox.edmunds.com/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://ws.matchbox.edmunds.com/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:tns0="http://definition.vehicle.edmunds.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns1="http://www.oracle.com/webservices/internal/literal"
>
<types>
<schema elementFormDefault="qualified" targetNamespace="http://definition.vehicle.edmunds.com/"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.oracle.com/webservices/internal/literal"
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://definition.vehicle.edmunds.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<import namespace="http://ws.matchbox.edmunds.com/"/>
<import namespace="http://www.oracle.com/webservices/internal/literal"/>
<complexType name="Make">
<sequence>
<element name="manufacturer" nillable="true" type="tns:Manufacturer"/>
<element name="models" nillable="true" type="ns1:set"/>
<element name="name" nillable="true" type="string"/>
<element name="id" nillable="true" type="long"/>
</sequence>
</complexType>
<complexType name="Manufacturer">
<sequence>
<element name="makes" nillable="true" type="ns1:set"/>
<element name="name" nillable="true" type="string"/>
<element name="id" nillable="true" type="long"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://www.oracle.com/webservices/internal/literal"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://www.oracle.com/webservices/internal/literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<import namespace="http://ws.matchbox.edmunds.com/"/>
<import namespace="http://definition.vehicle.edmunds.com/"/>
<complexType name="set">
<complexContent>
<extension base="tns:collection">
<sequence/>
</extension>
</complexContent>
</complexType>
<complexType name="collection">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="anyType"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://ws.matchbox.edmunds.com/"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://definition.vehicle.edmunds.com/"
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://ws.matchbox.edmunds.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<import namespace="http://www.oracle.com/webservices/internal/literal"/>
<import namespace="http://definition.vehicle.edmunds.com/"/>
<element name="createMakeElement">
<complexType>
<sequence>
<element name="String_1" nillable="true" type="string"/>
<element name="String_2" nillable="true" type="string"/>
</sequence>
</complexType>
</element>
<element name="createMakeResponseElement">
<complexType>
<sequence/>
</complexType>
</element>
<element name="findMakeElement">
<complexType>
<sequence>
<element name="Long_1" nillable="true" type="long"/>
</sequence>
</complexType>
</element>
<element name="findMakeResponseElement">
<complexType>
<sequence>
<element name="result" nillable="true" type="ns1:Make"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="RemoteTestVehicleServiceWS_createMake">
<part name="parameters" element="tns:createMakeElement"/>
</message>
<message name="RemoteTestVehicleServiceWS_createMakeResponse">
<part name="parameters" element="tns:createMakeResponseElement"/>
</message>
<message name="RemoteTestVehicleServiceWS_findMake">
<part name="parameters" element="tns:findMakeElement"/>
</message>
<message name="RemoteTestVehicleServiceWS_findMakeResponse">
<part name="parameters" element="tns:findMakeResponseElement"/>
</message>
<portType name="RemoteTestVehicleServiceWS">
<operation name="createMake">
<input message="tns:RemoteTestVehicleServiceWS_createMake"/>
<output message="tns:RemoteTestVehicleServiceWS_createMakeResponse"/>
</operation>
<operation name="findMake">
<input message="tns:RemoteTestVehicleServiceWS_findMake"/>
<output message="tns:RemoteTestVehicleServiceWS_findMakeResponse"/>
</operation>
</portType>
<binding name="HttpSoap11Binding" type="tns:RemoteTestVehicleServiceWS">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="createMake">
<soap:operation soapAction="http://ws.matchbox.edmunds.com//createMake"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="findMake">
<soap:operation soapAction="http://ws.matchbox.edmunds.com//findMake"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="VehicleService">
<port name="HttpSoap11" binding="tns:HttpSoap11Binding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>Graph and Circular dependencies cannot be model with document-literal message format with POJO development style. You will need to invent your own model to break the cycle and uses a mechanism similar to href, as with RPC-encoded message format.
All the best,
-Eric -
How to break Circular References.
I have on GUI class containing many components like Button, Combo Box, TextArea etc. And I have an other class ActionHandler which implements ActionListener,ItemListener and keyListener. GUI class has reference of ActionHandler class for handling events corresponding to the components in it and in ActionHandler class i need reference of GUI class for any modification/changes in the different GUI Components, based on the event generated.
This results in circular referencing between the two classes. How to avoid this situation.I don't think circular references are necessarilly a bad thing. However I generally put the GUI listners etc. inside the GUI class to which they relate, so they naturally have access to the GUI class without an explict pointer. More often than not these listener objects are tiny anonymous classes which do little more than call a private method in theGUI class.
-
Circular references between stored procedures
Hi, i need help about circular references. I have two stored procedures that references like that:
create or replace
procedure ciclico2 as
begin
ciclico1;
end;
create or replace
procedure ciclico1 as
begin
ciclico2;
end;
I can't compile both... so i want to know if there are ways to do that...
Thanks
Marcos (from Argentina... with a medium level english)¡Hola, Marcos!
If the procedures are in packages (or the same package), you can compile the package specs first, and then the package bodies.
It's simpler if both procedures are in the same package:
CREATE OR REPLACE PACKAGE pk_fubar
AS
PROCEDURE ciclico1;
PROCEDURE ciclico2;
END pk_fubar;
SHOW ERRORS
CREATE OR REPLACE PACKAGE BODY pk_fubar
AS
PROCEDURE ciclico1
IS
BEGIN
ciclico2;
END ciclico1
PROCEDURE ciclico2
IS
BEGIN
ciclico1;
END ciclico2
END pk_fubar
SHOW ERRORSOr you could put just one of them in a package.
The important thing is that you can compile a package spec and a package body separately.
You can compile anything that references a function in a package if a valid package spec exists; the package body may be invalid, or it may not exist at all. The package body has to exist and be valid before you run the procedure that calls it, of course, but not necessarily when you compile it. -
Hello Folks -
I am trying to implement both ManyToMany and OneToMany relationships in J2EE EJB3.0.
My application client has no problems, but when I expose my session bean methods as WebServices, I constantly run into this circular reference error.
My example tables are simple:
CREATE TABLE CLUB
ID NUMBER NOT NULL,
NAME VARCHAR2(100 BYTE) NOT NULL,
CITY VARCHAR2(100 BYTE) NOT NULL,
COUNTRY VARCHAR2(100 BYTE) NOT NULL
TABLESPACE USERS
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
CREATE UNIQUE INDEX CLUB_PK ON CLUB
(ID)
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
CREATE UNIQUE INDEX CLUB_UK1 ON CLUB
(NAME, COUNTRY)
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
ALTER TABLE CLUB ADD (
CONSTRAINT CLUB_PK
PRIMARY KEY
(ID)
USING INDEX
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
ALTER TABLE CLUB ADD (
CONSTRAINT CLUB_UK1
UNIQUE (NAME, COUNTRY)
USING INDEX
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
CREATE TABLE CONTRACTPERIOD
ID NUMBER NOT NULL,
PYR_ID NUMBER NOT NULL,
CUB_ID NUMBER NOT NULL,
START_DATE DATE NOT NULL,
END_DATE DATE
TABLESPACE USERS
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
CREATE UNIQUE INDEX CONTRACTPERIOD_PK ON CONTRACTPERIOD
(ID)
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
ALTER TABLE CONTRACTPERIOD ADD (
CONSTRAINT CONTRACTPERIOD_PK
PRIMARY KEY
(ID)
USING INDEX
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
ALTER TABLE CONTRACTPERIOD ADD (
CONSTRAINT CONTRACTPERIOD_FK
FOREIGN KEY (PYR_ID)
REFERENCES PLAYER (ID)
ON DELETE CASCADE);
ALTER TABLE CONTRACTPERIOD ADD (
CONSTRAINT CONTRACTPERIOD_FK2
FOREIGN KEY (CUB_ID)
REFERENCES CLUB (ID)
ON DELETE CASCADE);
CREATE TABLE PLAYER
ID NUMBER NOT NULL,
FIRSTNAME VARCHAR2(30 BYTE) NOT NULL,
LASTNAME VARCHAR2(30 BYTE) NOT NULL,
NATIONALITY VARCHAR2(30 BYTE) NOT NULL,
BIRTHDATE DATE NOT NULL
TABLESPACE USERS
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
CREATE UNIQUE INDEX PLAYERS_PK ON PLAYER
(ID)
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
ALTER TABLE PLAYER ADD (
CONSTRAINT PLAYERS_PK
PRIMARY KEY
(ID)
USING INDEX
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
Also the Stateless session bean is simple:
package demo;
import java.util.Collection;
import java.util.List;
import javax.ejb.Stateless;
import javax.jws.WebService;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;
@Stateless
@WebService
public class JavaServiceFacade {
private EntityManagerFactory emf = Persistence.createEntityManagerFactory("demo-1");
public JavaServiceFacade() {
public static void main(String [] args) {
final JavaServiceFacade javaServiceFacade = new JavaServiceFacade();
// TODO: Call methods on javaServiceFacade here...
Collection<Player> playerCollection = javaServiceFacade.queryPlayerFindAll();
for (Player player : playerCollection){
System.out.println(player.getFirstname()+" "+player.getLastname()+"\n");
Collection<Club> clubCollection = (Collection<Club>)javaServiceFacade.queryClubFindAll();
for (Club club : clubCollection){
System.out.println(club.getName()+"\n");
List<Contractperiod> contractperiodList= player.getContractperiodList();
for (Contractperiod contractperiod : contractperiodList){
System.out.println("contracts: "+ contractperiod.getClub().getName() + ": from: "
contractperiod.getStartDate()" to: " contractperiod.getEndDate() "\n");
private EntityManager getEntityManager() {
return emf.createEntityManager();
public Object mergeEntity(Object entity) {
final EntityManager em = getEntityManager();
try {
final EntityTransaction et = em.getTransaction();
try {
et.begin();
em.merge(entity);
et.commit();
} finally {
if (et != null && et.isActive()) {
entity = null;
et.rollback();
} finally {
if (em != null && em.isOpen()) {
em.close();
return entity;
public Object persistEntity(Object entity) {
final EntityManager em = getEntityManager();
try {
final EntityTransaction et = em.getTransaction();
try {
et.begin();
em.persist(entity);
et.commit();
} finally {
if (et != null && et.isActive()) {
entity = null;
et.rollback();
} finally {
if (em != null && em.isOpen()) {
em.close();
return entity;
/** <code>select o from Club o</code> */
public List<Club> queryClubFindAll() {
Query query = getEntityManager().createNamedQuery("Club.findAll");
return (List<Club>) query.getResultList();
public void removeClub(Club club) {
final EntityManager em = getEntityManager();
try {
final EntityTransaction et = em.getTransaction();
try {
et.begin();
club = em.find(Club.class, club.getId());
et.commit();
} finally {
if (et != null && et.isActive()) {
et.rollback();
} finally {
if (em != null && em.isOpen()) {
em.close();
/** <code>select o from Contractperiod o</code> */
public List<Contractperiod> queryContractperiodFindAll() {
Query query = getEntityManager().createNamedQuery("Contractperiod.findAll");
return (List<Contractperiod>) query.getResultList();
public void removeContractperiod(Contractperiod contractperiod) {
final EntityManager em = getEntityManager();
try {
final EntityTransaction et = em.getTransaction();
try {
et.begin();
contractperiod = em.find(Contractperiod.class, contractperiod.getId());
et.commit();
} finally {
if (et != null && et.isActive()) {
et.rollback();
} finally {
if (em != null && em.isOpen()) {
em.close();
/** <code>select o from Player o</code> */
public List<Player> queryPlayerFindAll() {
Query query = getEntityManager().createNamedQuery("Player.findAll");
return (List<Player>) query.getResultList();
public void removePlayer(Player player) {
final EntityManager em = getEntityManager();
try {
final EntityTransaction et = em.getTransaction();
try {
et.begin();
player = em.find(Player.class, player.getId());
et.commit();
} finally {
if (et != null && et.isActive()) {
et.rollback();
} finally {
if (em != null && em.isOpen()) {
em.close();
public void removeClub(Club player) {
final EntityManager em = getEntityManager();
try {
final EntityTransaction et = em.getTransaction();
try {
et.begin();
player = em.find(Player.class, player.getId());
et.commit();
} finally {
if (et != null && et.isActive()) {
et.rollback();
} finally {
if (em != null && em.isOpen()) {
em.close();
(A few commented lines, as I tried both OneToMany and ManyToMany...)
my Webservice result, after deploying to OC4J Standalone, is always the same:
Entity Beans:
package demo;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
@Entity
@NamedQuery(name = "Club.findAll", query = "select o from Club o")
public class Club implements Serializable {
@Column(nullable = false)
private String city;
@Column(nullable = false)
private String country;
@Id
@Column(nullable = false)
private Long id;
@Column(nullable = false)
private String name;
@ManyToMany(mappedBy = "clubCollection",cascade={CascadeType.PERSIST})
private Collection<Player> playerCollection;
public Club() {
public String getCity() {
return city;
public void setCity(String city) {
this.city = city;
public String getCountry() {
return country;
public void setCountry(String country) {
this.country = country;
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
public Collection<Player> getPlayerCollection() {
return playerCollection;
public void setPlayerCollection(Collection<Player> playerCollection) {
this.playerCollection = playerCollection;
public Contractperiod addContractperiod(Contractperiod contractperiod) {
getContractperiodList().add(contractperiod);
contractperiod.setClub(this);
return contractperiod;
public Contractperiod removeContractperiod(Contractperiod contractperiod) {
getContractperiodList().remove(contractperiod);
contractperiod.setClub(null);
return contractperiod;
package demo;
import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
@Entity
@NamedQuery(name = "Contractperiod.findAll",
query = "select o from Contractperiod o")
public class Contractperiod implements Serializable {
@Column(name="END_DATE")
private Timestamp endDate;
@Id
@Column(nullable = false)
private Long id;
@Column(name="START_DATE", nullable = false)
private Timestamp startDate;
@ManyToOne
@JoinColumn(name = "PYR_ID", referencedColumnName = "ID")
private Player player;
@ManyToOne
@JoinColumn(name = "CUB_ID", referencedColumnName = "ID")
private Club club;
public Contractperiod() {
public Timestamp getEndDate() {
return endDate;
public void setEndDate(Timestamp endDate) {
this.endDate = endDate;
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
public Timestamp getStartDate() {
return startDate;
public void setStartDate(Timestamp startDate) {
this.startDate = startDate;
public Player getPlayer() {
return player;
public void setPlayer(Player player) {
this.player = player;
public Club getClub() {
return club;
public void setClub(Club club) {
this.club = club;
package demo;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
@Entity
@NamedQuery(name = "Player.findAll", query = "select o from Player o")
public class Player implements Serializable {
@Column(nullable = false)
private Timestamp birthdate;
@Column(nullable = false)
private String firstname;
@Id
@Column(nullable = false)
private Long id;
@Column(nullable = false)
private String lastname;
@Column(nullable = false)
private String nationality;
@ManyToMany
@JoinTable(name="CONTRACTPERIOD",
joinColumns=@JoinColumn(name="PYR_ID"),
inverseJoinColumns=@JoinColumn(name="CUB_ID"))
private Collection<Club> clubCollection;
public Player() {
public Timestamp getBirthdate() {
return birthdate;
public void setBirthdate(Timestamp birthdate) {
this.birthdate = birthdate;
public String getFirstname() {
return firstname;
public void setFirstname(String firstname) {
this.firstname = firstname;
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
public String getLastname() {
return lastname;
public void setLastname(String lastname) {
this.lastname = lastname;
public String getNationality() {
return nationality;
public void setNationality(String nationality) {
this.nationality = nationality;
public Collection<Club> getClubCollection() {
return clubCollection;
public void setClubCollection(Collection<Club> clubCollection) {
this.clubCollection = clubCollection;
public Contractperiod addContractperiod(Contractperiod contractperiod) {
getContractperiodList().add(contractperiod);
contractperiod.setPlayer(this);
return contractperiod;
public Contractperiod removeContractperiod(Contractperiod contractperiod) {
getContractperiodList().remove(contractperiod);
contractperiod.setPlayer(null);
return contractperiod;
<env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns0="http://demo/">
<env:Body>
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>Internal Server Error (circular reference detected while serializing: demo.Contractperiod)</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
Anyone else run into this Troll?
All suggestions(almost all) received with thanks.
Regards,
Charles
Some strange error messages in Diagnostic Logs:
Log Message: September 18, 2006 3:58:02 PM CEST
Component Name OC4J Component ID j2ee
Host Network Address 192.168.1.69 Message Level 1
Module ID home_ejb.transaction User ID Charles
Execution Context ID 192.168.1.69:35920:1158587882221:405 Execution Context Sequence 0
Host Name vmware Message ID J2EE EJB-08006
Thread ID 44 Message Type Error
J2EE Application Module OraPorterAPIdeploy J2EE Application OraPorterAPIdeploy
Web Service Port JavaServiceFacade Web Service Name JavaServiceFacadeService
Message Text
[JavaServiceFacade:public java.util.List demo.JavaServiceFacade.queryClubFindAll()] exception occurred during method invocation: oracle.
Supplemental Text
oracle.oc4j.rmi.OracleRemoteException: java.lang.IllegalStateException: ClassLoader "OraPorterAPIdeploy.root:0.0.0" (from <application>
in /C:/Oracle/oc4j/j2ee/home/applications/OraPorterAPIdeploy/): This loader has been closed and should not be in use.
Nested exception is:
java.lang.IllegalStateException: ClassLoader "OraPorterAPIdeploy.root:0.0.0" (from <application> in /C:/Oracle/oc4j/j2ee/home/applications/OraPorterAPIdeploy/):
This loader has been closed and should not be in use.
........This loader has been
closed and should not be in use.; nested exception is:
java.lang.IllegalStateException: ClassLoader
Message was edited by:
promise
Message was edited by:
promiseHei Guys -
I see that the ClassLoader exceptions are known, and are "to be ignored".
I left a reference to them, in case they play into our problems anyway.....
"java.lang.IllegalStateException: ClassLoader" - known harmless bug... ?
Best Regards,
Charles -
Circular references in Hashtable
Hi,
I was wondering if anyone could help me in determining when circular references appear in java.util.Hashtable I have written a class that serializes any arbitrary java object into XML. The problem occurs when the object contains many references to Hashtables. The serializer does not know how to handle circular references and goes into an infinite loop causing a stack overflow. Any help would be greatly appreciated.Hi.
The solution is simple: keep all the processed objects in a set or map. Before sending an object check if it was already processed. If not, process it. If yes, place a reference in the XML file that will enable you to read find it during the read.
Java Serialization uses a "serial number" for the objects it serializes. It keeps something like an HashMap of the objects already serialized. When writing, if it finds an object already writen it only writes its serial number. When reading a serial number it uses a map of the objects already read to find the object.
Hope this helps,
Nuno
Maybe you are looking for
-
Submitting forms to external sites
Hey All Is it somehow possible to submit forms to external sites using NETUI form tag? In this case its a card-payment server that needs alot of info stored in my controller.jpf. The easiste way to access this, is through NETUI tags. Unfortunatly it
-
Cant view multipage tiff files in browser after updating ITUNES
I can't view multi-page tiff files in my browser after updating Itunes. I am not sure why an Itunes update would stop the viewing of Multi-page Tiff files, but it did! Is there a fix for this? thanks
-
Hi all - I've learned a lot from the posts on setting up a RAID array on my new Mac Pro - thank you for all the info. Apple Care Support said that they do not support RAID configurations, so they can't help me understand some of the thornier question
-
On DPS how can I set the layers in the correct order for adobe viewer?
How can I set it so the icons appear behind the apple the same as the first picture but for adobe viewer as well
-
Web Dynpro message manager and popups
Hi, I am using IF_WD_MESSAGE_MANAGER to issue error messages to screen with methods REPORT_ERROR_MESSAGE and REPORT_EXCEPTION. This works fine and the messages appear on the top of the screen. Both methods have a parameter SHOW_AS_POPUP, but setting