FK problem when inserting one-to-many records
Hi everybody,
I see that this subject has been discussed here from time to time before, as in:
insert record with 1-M mapping missing foreign key using UOW
Sequences and multiple tables for inheritance
I followed Dougs advice on several posts, to check out the employee exampled shipped with Toplink, but regardless of all this information, I'm still stuck.
So, my issue: when I create new objects, add them to some other objects collection, and then call "assign sequence numbers" on all of them, the sequencenumbers are assgned all the way down the hierachy, but the upward links - the foreign keys - are not updated with the ID's of the parent object.
Simple example (might not compile - demo code):
<JAVA>
myInputController.session = (DatabaseSession)
SessionManager.getManager().getSession("some_session");
UnitOfWork myUnitOfWork = myInputController.session.acquireUnitOfWork();
// Father and Child are a Toplink objects, persisted to each their table with a
// FK relation, is now assigned to the UOW
Father myDBFather = (Father) myUnitOfWork.registerObject(new Father());
Child myDBChild = new Child();
myDBFather.getChildCollection().add(myDBChild);
// Now I could use the accessor methods of the Toplink objects to set
// stuff like name, phone number or so, but that's not important for demo.
// I just want to save my objects to the database. To do so, I need to
// assign sequence numbers:
myUnitOfWork.assignSequenceNumbers();
// I check the ID's before writing to DB:
System.out.println(myDBFather.GetId().toString());
System.out.println(myDBChild.GetId().toString());
// They both return valid numbers, similar to what the sequence objects
// of the database should asssign, so that works.
// But:
System.out.println(myDBChild.GetFaterid().toString());
// Will return null, even if myDBChild is a child of myDBFather, and
// hence a commit to the database will fail (no foreign key!).
// I can fix this, by "manually" setting the id:
myDBChild.SetFatherid(myDBFather.getId());
// And then a commit to the database will work:
myUnitOfWork.commit();
// But, since I have deep hierachies, and don't allways know what
// objects have been added/changed, it's a pretty wild thing, not
// to menition un-ellegant and heavy in maintenance, to loop down
// through the entire collection and update all foreign key ID's
// (FatherID's) before committing changes.
</JAVA>
I guess I'm just not hitting the right button somewhere? To create the Toplink Java classes and descriptors, I used "Java objects from tables" in JDev 10.1.2, both "as is", and with some tinkering on indirection, transparency and bi-directional relationships. Also, I get same results in the Toplink 10.1.3 dp4.
I must have missed the answer somewhere out there, but must post after trying really hard!
Best regards to all of you,
:) Ulf
I could kick myself right now!
The child setFatherid method takes an entire father object, so the code must be myDBChild.SetFatherid(myDBFather); instead of the myDBChild.SetFatherid(myDBFather.getId()); My apologies.
With the issue still very present, I post some code from the auto-generated child-class and the child-class descriptor below, which might give some pointers.
<JAVA-FRAGMENT>
package dk.test.fatherchild.model;
import oracle.toplink.indirection.ValueHolder;
import oracle.toplink.indirection.ValueHolderInterface;
public class Child {
* Map fatherid <-> dk.test.fatherchild.model.Father
* @associates <{dk.test.fatherchild.model.Father}>
private ValueHolderInterface fatherid;
private Double childid;
private String childName;
public Child() {
super();
this.fatherid = new ValueHolder();
</JAVA-FRAGMENT>
<Child.ClassDescriptor.xml-FRAGMENT>
<mapping>
<inherited>false</inherited>
<instance-variable-name>fatherid</instance-variable-name>
<uses-method-accessing>false</uses-method-accessing>
<read-only>false</read-only>
<get-method-handle>
<method-handle empty-aggregate="true"/>
</get-method-handle>
<set-method-handle>
<method-handle empty-aggregate="true"/>
</set-method-handle>
<reference-descriptor>dk.test.fatherchild.model.Father.ClassDescriptor</reference-descriptor>
<private-owned>false</private-owned>
<uses-batch-reading>false</uses-batch-reading>
<maintains-bidirectional-relationship>true</maintains-bidirectional-relationship>
<relationship-partner-mapping-name>childCollection</relationship-partner-mapping-name>
<table-reference-mapping-reference-handle>
<reference-handle>
<reference-table>PERIODICA2.CHILD</reference-table>
<reference-name>CHILD_FATHER_FK</reference-name>
</reference-handle>
</table-reference-mapping-reference-handle>
<uses-joining>false</uses-joining>
<one-to-one-mapping-indirection-policy>
<indirection-policy>
<uses-indirection>true</uses-indirection>
</indirection-policy>
</one-to-one-mapping-indirection-policy>
<mapping-class>MWOneToOneMapping</mapping-class>
</mapping>
</Child.ClassDescriptor.xml-FRAGMENT>
Similar Messages
-
Problem inserting one-to-many collection
Hi,
I've been trying to get an object (CMDMessage) that has a one-to-many collection (CMDMessageXREF)
inserted into the database, but no matter what I try I can't seem to get the collection to grab the
foreign key value of 'msg_id' to populate that field in the CMDMessageXREF object, I keep getting a nul value.
From reading the forums, it seems the best way to get this value is to setup a back reference one-to-one mapping from the collection to the parent
object, but this doesn't seem to be working from me.
I've attached the pertinent client code as well as the pertinent information from the descriptors and would
appreciate any help on this.
Thanks,
Mark
Client code:
CMDMessage note = new CMDMessage();
note.setAuthorId(new Double(58402));
note.setMsgSubject("Sequence test2");
java.util.ArrayList xrefCollection = new java.util.ArrayList();
CMDMessageXREF xref = new CMDMessageXREF();
xref.setRecipientId(new Double(58400));
xref.setRecipientType("org");
xrefCollection.add(xref);
note.setCmdMessageXrefCollection(xrefCollection);
// runs transaction invoking UnitOfWork to insert objects
TransactionEngine.insert(note);
Descriptors:
public Descriptor buildCMDMessageDescriptor() {
Descriptor descriptor = new Descriptor();
descriptor.setJavaClass(CMDMessage.class);
descriptor.addTableName("CMD_MESSAGE");
descriptor.addPrimaryKeyFieldName("CMD_MESSAGE.MSG_ID");
// Descriptor properties.
descriptor.useNoIdentityMap();
descriptor.setIdentityMapSize(1000);
descriptor.useRemoteNoIdentityMap();
descriptor.setRemoteIdentityMapSize(1000);
descriptor.setSequenceNumberFieldName("CMD_MESSAGE.MSG_ID");
descriptor.setSequenceNumberName("CMD_MSG_ID_SEQUENCE");
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.onlyRefreshCacheIfNewerVersion();
descriptor.setAlias("CMDMessage");
// Query manager.
descriptor.useChangedFieldsLocking();
descriptor.getQueryManager().checkDatabaseForDoesExist();
//Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping msgIdMapping = new DirectToFieldMapping();
msgIdMapping.setAttributeName("msgId");
msgIdMapping.setGetMethodName("getMsgId");
msgIdMapping.setSetMethodName("setMsgId");
msgIdMapping.setFieldName("CMD_MESSAGE.MSG_ID");
descriptor.addMapping(msgIdMapping);
DirectToFieldMapping msgSubjectMapping = new DirectToFieldMapping();
msgSubjectMapping.setAttributeName("msgSubject");
msgSubjectMapping.setGetMethodName("getMsgSubject");
msgSubjectMapping.setSetMethodName("setMsgSubject");
msgSubjectMapping.setFieldName("CMD_MESSAGE.MSG_SUBJECT");
descriptor.addMapping(msgSubjectMapping);
OneToManyMapping cmdMessageXrefCollectionMapping = new OneToManyMapping();
cmdMessageXrefCollectionMapping.setAttributeName("cmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setGetMethodName("getCmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setSetMethodName("setCmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setReferenceClass(CMDMessageXREF.class);
cmdMessageXrefCollectionMapping.useTransparentCollection();
cmdMessageXrefCollectionMapping.useCollectionClass(oracle.toplink.indirection.IndirectList.class);
cmdMessageXrefCollectionMapping.readOnly();
cmdMessageXrefCollectionMapping.addTargetForeignKeyFieldName("CMD_MESSAGE_XREF.MSG_ID", "CMD_MESSAGE.MSG_ID");
descriptor.addMapping(cmdMessageXrefCollectionMapping);
return descriptor;
public Descriptor buildCMDMessageXREFDescriptor() {
Descriptor descriptor = new Descriptor();
descriptor.setJavaClass(CMDMessageXREF.class);
descriptor.addTableName("CMD_MESSAGE_XREF");
descriptor.addPrimaryKeyFieldName("CMD_MESSAGE_XREF.ID");
// Descriptor properties.
descriptor.useNoIdentityMap();
descriptor.setIdentityMapSize(1000);
descriptor.useRemoteNoIdentityMap();
descriptor.setRemoteIdentityMapSize(1000);
descriptor.setSequenceNumberFieldName("CMD_MESSAGE_XREF.ID");
descriptor.setSequenceNumberName("CMD_MSG_XREF_ID_SEQ");
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.onlyRefreshCacheIfNewerVersion();
descriptor.setAlias("CMDMessageXREF");
// Query manager.
descriptor.useChangedFieldsLocking();
descriptor.getQueryManager().checkDatabaseForDoesExist();
//Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setGetMethodName("getId");
idMapping.setSetMethodName("setId");
idMapping.setFieldName("CMD_MESSAGE_XREF.ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping msgIdMapping = new DirectToFieldMapping();
msgIdMapping.setAttributeName("msgId");
msgIdMapping.setGetMethodName("getMsgId");
msgIdMapping.setSetMethodName("setMsgId");
msgIdMapping.setFieldName("CMD_MESSAGE_XREF.MSG_ID");
descriptor.addMapping(msgIdMapping);
DirectToFieldMapping recipientIdMapping = new DirectToFieldMapping();
recipientIdMapping.setAttributeName("recipientId");
recipientIdMapping.setGetMethodName("getRecipientId");
recipientIdMapping.setSetMethodName("setRecipientId");
recipientIdMapping.setFieldName("CMD_MESSAGE_XREF.RECIPIENT_ID");
descriptor.addMapping(recipientIdMapping);
OneToOneMapping cmdMessageInfoMapping = new OneToOneMapping();
cmdMessageInfoMapping.setAttributeName("cmdMessageInfo");
cmdMessageInfoMapping.setGetMethodName("getCmdMessageInfoHolder");
cmdMessageInfoMapping.setSetMethodName("setCmdMessageInfoHolder");
cmdMessageInfoMapping.setReferenceClass(CMDMessage.class);
cmdMessageInfoMapping.useBasicIndirection();
cmdMessageInfoMapping.readOnly();
cmdMessageInfoMapping.addTargetForeignKeyFieldName("CMD_MESSAGE.MSG_ID", "CMD_MESSAGE_XREF.MSG_ID");
descriptor.addMapping(cmdMessageInfoMapping);
return descriptor;
}Chris,
Ok, I've tried both approaches
1. using direct field mapping, getting rid of the one to one mapping on the CMDMessageXREF object, and adding this line xref.setMsgId( note.getMsgId()
and
2. removing the readOnly line for the mappings and setting the CMDMessage in the CMDMessageXREF object as shown below in bold.
but still am getting the same error. Could this be because the MSG_ID field in the database is NOT NULL? Otherwise, I am not seeing what else I can do differently to set this up. Below is the updated relevant code and descriptor showing the second approach I used.
Thanks for the help,
Mark
Client code
CMDMessage note = new CMDMessage();
note.setAuthorId(new Double(58402));
note.setMsgSubject("Sequence test2");
java.util.ArrayList xrefCollection = new java.util.ArrayList();
CMDMessageXREF xref = new CMDMessageXREF();
xref.setRecipientId(new Double(58400));
// added to set value to valueHolder
xref.setCmdMessageInfo(note);
xrefCollection.add(xref);
note.setCmdMessageXrefCollection(xrefCollection);
TransactionEngine.insert(note);
Descriptors
public Descriptor buildCMDMessageDescriptor() {
Descriptor descriptor = new Descriptor();
descriptor.setJavaClass(CMDMessage.class);
descriptor.addTableName("CMD_MESSAGE");
descriptor.addPrimaryKeyFieldName("CMD_MESSAGE.MSG_ID");
// Descriptor properties.
descriptor.useNoIdentityMap();
descriptor.setIdentityMapSize(1000);
descriptor.useRemoteNoIdentityMap();
descriptor.setRemoteIdentityMapSize(1000);
descriptor.setSequenceNumberFieldName("CMD_MESSAGE.MSG_ID");
descriptor.setSequenceNumberName("CMD_MSG_ID_SEQUENCE");
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.onlyRefreshCacheIfNewerVersion();
descriptor.setAlias("CMDMessage");
// Query manager.
descriptor.useChangedFieldsLocking();
descriptor.getQueryManager().checkDatabaseForDoesExist();
//Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping msgIdMapping = new DirectToFieldMapping();
msgIdMapping.setAttributeName("msgId");
msgIdMapping.setGetMethodName("getMsgId");
msgIdMapping.setSetMethodName("setMsgId");
msgIdMapping.setFieldName("CMD_MESSAGE.MSG_ID");
descriptor.addMapping(msgIdMapping);
OneToManyMapping cmdMessageXrefCollectionMapping = new OneToManyMapping();
cmdMessageXrefCollectionMapping.setAttributeName("cmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setGetMethodName("getCmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setSetMethodName("setCmdMessageXrefCollection");
cmdMessageXrefCollectionMapping.setReferenceClass(CMDMessageXREF.class);
cmdMessageXrefCollectionMapping.useTransparentCollection();
cmdMessageXrefCollectionMapping.useCollectionClass(oracle.toplink.indirection.IndirectList.class);
cmdMessageXrefCollectionMapping.addTargetForeignKeyFieldName("CMD_MESSAGE_XREF.MSG_ID", "CMD_MESSAGE.MSG_ID");
descriptor.addMapping(cmdMessageXrefCollectionMapping);
return descriptor;
public Descriptor buildCMDMessageXREFDescriptor() {
Descriptor descriptor = new Descriptor();
descriptor.setJavaClass(CMDMessageXREF.class);
descriptor.addTableName("CMD_MESSAGE_XREF");
descriptor.addPrimaryKeyFieldName("CMD_MESSAGE_XREF.ID");
// Descriptor properties.
descriptor.useNoIdentityMap();
descriptor.setIdentityMapSize(1000);
descriptor.useRemoteNoIdentityMap();
descriptor.setRemoteIdentityMapSize(1000);
descriptor.setSequenceNumberFieldName("CMD_MESSAGE_XREF.ID");
descriptor.setSequenceNumberName("CMD_MSG_XREF_ID_SEQ");
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.onlyRefreshCacheIfNewerVersion();
descriptor.setAlias("CMDMessageXREF");
// Query manager.
descriptor.useChangedFieldsLocking();
descriptor.getQueryManager().checkDatabaseForDoesExist();
//Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setGetMethodName("getId");
idMapping.setSetMethodName("setId");
idMapping.setFieldName("CMD_MESSAGE_XREF.ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping recipientIdMapping = new DirectToFieldMapping();
recipientIdMapping.setAttributeName("recipientId");
recipientIdMapping.setGetMethodName("getRecipientId");
recipientIdMapping.setSetMethodName("setRecipientId");
recipientIdMapping.setFieldName("CMD_MESSAGE_XREF.RECIPIENT_ID");
descriptor.addMapping(recipientIdMapping);
OneToOneMapping cmdMessageInfoMapping = new OneToOneMapping();
cmdMessageInfoMapping.setAttributeName("cmdMessageInfo");
cmdMessageInfoMapping.setGetMethodName("getCmdMessageInfoHolder");
cmdMessageInfoMapping.setSetMethodName("setCmdMessageInfoHolder");
cmdMessageInfoMapping.setReferenceClass(CMDMessage.class);
cmdMessageInfoMapping.useBasicIndirection();
cmdMessageInfoMapping.addTargetForeignKeyFieldName("CMD_MESSAGE.MSG_ID", "CMD_MESSAGE_XREF.MSG_ID");
descriptor.addMapping(cmdMessageInfoMapping);
return descriptor;
} -
Problem when inserting "Thai language" string to MS Access with JSP
Dear sir,
I have the problem when try to insert "Thai langusge" string to MS access database through JDBC in JSP page.
The JSP page is shown in the following.
<HTML><HEAD><TITLE>Personalt Information</TITLE>
<%@ page contentType="text/html; charset=MS874" %>
<%@ page import = "java.io.*" %>
<%@ page import = "java.lang.*"%>
<%@ page import = "java.sql.*"%>
<%
Connection dbconn,conn;
ResultSet results;
String sql;
Statement stmt;
// Creating a conection with a database
String url = "jdbc:odbc:bg3hrDB"; // the database file.
//Statement stmt;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dbconn = DriverManager.getConnection(url);
stmt = dbconn.createStatement();
ResultSet rs;
%>
%>
<%
String code=new String(request.getParameter("code").getBytes("ISO8859_1"),"MS874");
String status=new String(request.getParameter("status").getBytes("ISO8859_1"),"MS874");
String fname=new String(request.getParameter("fname").getBytes("ISO8859_1"),"MS874");
sql = "INSERT INTO employee VALUES (' "+ code +" ',' "+ status +" ',' "+ fname +" ')";
stmt.executeUpdate(sql);
%>
<%=fname%> //In this line, "fname" can show "Thai" correctly
But after inserted to database, the record in Access was always show "?????" instead of "Thai"......
How can i solve this?
Thank you for your kindness in advances.
Yongyos K.It's a pain in the butt, but you'll have to write your own character set conversion to handle the problem. Check out the link shown below (just replace BIG5 in the example with MS874):
http://www.geocities.com/siufai6/java/JDBC_Chinese.html
;o)
V.V. -
Problem when inserting Spry Tabbed Panels
Hi all,
Just lately i started to get this message when inserting spry
tabs
" ! The structure of this widget appears to be damaged. Go to
Code view and repair the widget, or replace the widget."
Anyone know why and how to fix it? At first i thought it has
something to do with my current page, but when i tried in a blank
html, still got the same problem.
I have CS3 and Spry 1.6.1. I didnt touch the .js and .css
file for this spry. I checked for Spry updates, installed and
reinstalled spry, still get the same message.
Please help!!!
thanksThanks Kin,
here is the code. i created a new html and inserted tabs from
the spry tab. no other changes are made. Still getting the same
error.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<title>Untitled Document</title>
<script src="file:///C|/Documents and
Settings/xd064c/Application Data/Adobe/Dreamweaver
9/Configuration/Temp/Assets/eam50.tmp/SpryTabbedPanels.js"
type="text/javascript"></script>
<link href="file:///C|/Documents and
Settings/xd064c/Application Data/Adobe/Dreamweaver
9/Configuration/Temp/Assets/eam50.tmp/SpryTabbedPanels.css"
rel="stylesheet" type="text/css" />
</head>
<body><div id="TabbedPanels1"
class="TabbedPanels"><ul
class="TabbedPanelsTabGroup"><li class="TabbedPanelsTab"
tabindex="0">Tab
1</li><li class="TabbedPanelsTab"
tabindex="0">Tab 2</li></ul><div
class="TabbedPanelsContentGroup"><div
class="TabbedPanelsContent">Content
1</div><div class="TabbedPanelsContent">Content
2</div></div></div><script
type="text/javascript">
<!--
var TabbedPanels1 = new
Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script></body></html>
>>>>>Also, the add panel function from the
properties panel doesnt work correctly. the code below is what i
get when i add a panel.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<title>Untitled Document</title>
<script src="file:///C|/Documents and
Settings/xd064c/Application Data/Adobe/Dreamweaver
9/Configuration/Temp/Assets/eam50.tmp/SpryTabbedPanels.js"
type="text/javascript"></script>
<link href="file:///C|/Documents and
Settings/xd064c/Application Data/Adobe/Dreamweaver
9/Configuration/Temp/Assets/eam50.tmp/SpryTabbedPanels.css"
rel="stylesheet" type="text/css" />
</head>
<body><div id="TabbedPanels1"
class="TabbedPanels"><ul
class="TabbedPanelsTabGroup"></ul><div
class="TabbedPanelsContentGroup"></div><ul
class="TabbedPanelsTabGroup"></ul><div
class="TabbedPanelsContentGroup"></div><ul
class="TabbedPanelsTabGroup"></ul><div
class="TabbedPanelsContentGroup"></div><ul
class="TabbedPanelsTabGroup"></ul><div
class="TabbedPanelsContentGroup"></div><ul
class="TabbedPanelsTabGroup"><li class="TabbedPanelsTab"
tabindex="0">Tab
1</li><li class="TabbedPanelsTab"
tabindex="0">Tab 2</li></ul><div
class="TabbedPanelsContentGroup"><div
class="TabbedPanelsContent">Content
1</div><div class="TabbedPanelsContent">Content
2</div></div></div><script
type="text/javascript">
<!--
var TabbedPanels1 = new
Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script></body></html>
Thank you. -
SmartView - Error when i drill down many records
Hi,
Our users are currently receiving the error "Invalid Pointer", when trying to refresh Smart View reports or when users are trying to drill down.
Do you know how many records can i see using drill down in smart view.
And if this number of records can be change?
Thanks!If you're just trying to increase the number of rows that can be retrieved, see: Maximum rows exceed in SmartView
Do you get an error in the applicaiton log? Essbase log? I ask because I wonder if the error is SmartView/Hyperion Provider Services related or from the database.
Regards,
Cameron Lackpour -
Iwork 09 Pagination problems when inserting Section Brake
Hello Guys,
I have a stressfull problem with Pages when inserting Section Brakes in pages. The page numbers don't appear correctly, can't see the entire number of the page. For example at page 20 I can only see 2 and a very small part of 0. it's very frustrating. This problem persists when saving the file in pdf or .doc format.
Any solution to this, besides including the page number in the footer? The footer is filled with something else.Perhaps those "brakes" are stopping the section too quickly, and the numbers are slipping off the right side of the page.
Where are you inserting the page numbers? The usual place is either the page header or the page footer. I used a 125 page document with section breaks at pages 17 and 96 and tried inserting page numbers in the header, footer, as well as at the right end of several lines in the main text body, using a right justified line, or a right tab stop or a left tab stop.
All behaved as expected and showed the whole page number, as seen below:
100 is in a footer, the small 101 in a header. The four larger numbers are in the body text area.
left justified, right tablat right margin, pn follows a tab character
right justified
left justified, left tab stop at 7 3/8 inches, pn follows a tab character, and is forced to next line because there is not sufficient room for it between the left tab and the right margin. (Left margin is set to 5 1/2 inches to reduce width of screen shot.)
left justified, right tab stop at 7 3/8 inches.
As can be seen, I'm unable to reproduce the problem, using the information you've given, and guessing possible locations for the page numbers.
Regards,
Barry
incidently, Headers and Footers aren't restricted to a single line of text. You could place the page number on a second line of the footer, or even on a third line to allow some space between it and the rest of the footer contents.
B. -
Problem when inserting blank record.
Dear All,
I have following taskflow structure
execute (master)
createinsert (detail)
pagefragment
my page fragment has 1 master record.. 1 detail record. (which would be blank one except pk and fk generated from viewlink)
when the user saves (commit action click)record the master saves.. but the child doesnot saves
what i noticed is that when i enter any field in af:table(detail) it saves... but i want to insert the blank record to database.
Any ideas..?
Regards,
Santosh
jdev 11.1.1.5.0
Edited by: Santosh Vaza on Aug 26, 2011 10:08 PMHi..
read following will useful
http://blogs.oracle.com/shay/entry/master_with_two_details_on_the -
ADF BC : Problem in Inserting a Master - Detail Record
Hi,
I am new to ADF Business Components. I am into a project where i use only the ADF BC as ORM/DB Operations and for the front end I use some other framework. The Problem is.
I have two entity objects and a ViewLink between them. [Relation between "Order" to "Item" is (1 to many relation)].
[I saw many examples in forums where its explained with View Objects But here I DID NOT create any View Object. I have only Entity Objects]
(1) OrderEO [Entity Object for Order Table]
(2) ItemEO [Entity Object for Items Table]
(3) OrderItemsViewLink [A Viewlink where OrderEO.OrderId = ItemEO.OrderId]
All The Primary keys (for the "Order" and "Items" table ) are handled by Trigger+Sequence at the time of insert in DB side.
I created custom method to insert "Order" individually it worked fine.
I created custom method to insert the "Item" individually it worked fine.
But...
When I created and "Order" with some "Items" It failing to insert and throws an
Error : oracle.jbo.InvalidOwnerException: JBO-25030: Failed to find or invalidate owning entity: detail entity ItemEO, row key oracle.jbo.Key[0 ].
My Custom Method in the AppModuleImpl is like below :
public void createNewOrderWithNewItems() {
String entityName = "com.proj.entities.OrderEO";
EntityDefImpl orderDef = EntityDefImpl.findDefObject(entityName);
OrderEOImpl newOrder = (OrderEOImpl)orderDef .createInstance2(getDBTransaction(),null);
try {
// 3. Set attribute values
newOrder .setOrderStatusCode("CREATED");
RowIterator items = newOrder .getItemEO();
Row newItemRow = items .createAndInitRow(null);
items .insertRow(newItemRow );
newItemRow .setAttribute("itemDate", new Date());
newItemRow .setAttribute("itemQty", new Number(10));
// 4. Commit the transaction
getDBTransaction().commit();
} catch (SQLException e) {
e.printStackTrace();
} catch (JboException ex) {
getDBTransaction().rollback();
throw ex;
Here the "Order" is also new and related Items is also new. What I expect is to save the Order with Items in one transaction. How to achieve this. Please suggest.
Thanks
Narayan
Edited by: 817942 on Dec 3, 2010 8:16 AMRead through the blog posts which describes
why this issue occurs and how it should be resolved.
http://radio-weblogs.com/0118231/stories/2003/01/17/whyDoIGetTheInvalidownerexception.html
http://one-size-doesnt-fit-all.blogspot.com/2008/05/jbo-25030-failed-to-find-or-invalidate.html
Thanks,
Navaneeth -
Need trigger when update one column then record sysdate on another collumn
Hi
Gurus
I have a table called RTV_PLAN
And it have two columns,
FORCE_KEYIN_FLAG VARCHAR(2)
FORCE_KEYIN_DATE DATE
I want when FORCE_KEYIN_FLAG get a value
Then FORCE_KEYIN_DATE record the sysdate
Please kindly give some help
Many thanks
savenHi
Justin
thank you!
It works for me very well.
I use this code before
<div class="jive-message-body"><div class="jive-quote"><span class="jive-quote-header"> if updating then
</div>
with your help my code is below now,
<div class="jive-message-body"><div class="jive-quote"><span class="jive-quote-header">
create or replace TRIGGER "RTV_PLAN_TRIG"
before insert or update on RTV_PLAN
for each row
declare
SCRAP_flag rtv_plan.SCRAP_flag%TYPE;
force_keyin_flag rtv_plan.force_keyin_flag%TYPE;
begin
if inserting then
if :NEW.RTV_PLAN_KEY is null then
:NEW.RTV_PLAN_KEY := SAVEN.RTV_PLAN_api.RTV_gen_pk;
end if;
:NEW.dc_receive_date := sysdate;
end if;
if ( :new.scrap_flag IS NOT NULL ) then
:NEW.SCRAP_date := sysdate;
:NEW.SCRAP_USER := nvl(v('APP_USER'),USER);
end if;
if ( :new.force_keyin_flag IS NOT NULL )
then
:NEW.FORCE_KEYIN_date := sysdate;
:NEW.FORCE_KEYIN_USER := nvl(v('APP_USER'),USER);
end if;
end;
</div>
can you checking this whether they have other error ?
thank you
saven -
URGENT -- Problems when inserting/updating entries in a database tables
Hi,
I've created a custom table via SE11. Then I also created a custom program that will popuate entries in the table that I created.
When I ran the program, there were more than 6,000 entries that should be populated. But when I checked on the table, there were only 2000 entries populated. I am not sure what's wrong with my table. I tried changing the size category in the technical settings to handle larger volume of data but this does not seem to work.
Please advise.Hello Maria
The resizing of DB tables is done automatically by the SAP system so this is not the problem.
It is more likely that your list of records contains duplicate entries.
How does your report insert the records? By using INSERT or MODIFY? I assume you are using MODIFY.
To be sure about the true number of genuine records simply add the following statement to your coding:
SORT gt_itab BY keyfld1 keyfld2 ... . " sort itab by all key fields
DELETE ADJACENT DUPLICATES FROM gt_itab
COMPARING keyfld1 keyfld2 ... . " delete all duplicate entries having same key fields
DESCRIBE TABLE gt_itab. " fills sy-tfill with number of records
MESSAGE sy-tfill TYPE 'I'. " output of true record number
Regards
Uwe -
Strange Problem When Inserting " £ " character in a varchar2 column
Hello
This is a very strange issue i am facing when i use SQL+ on different clients.
Client 1 ( SQL+) 9.2.0.4.0
conn scott@ora9i
SQL> insert into dummy values( '£');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from dummy;
A
¿
Client 2 ( SQL+) 9.2.0.4.0
conn scott@ora9i
SQL> insert into dummy values( '£');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from dummy;
A
£
Has any one faced this issue before , I am sure it is something to do with Client Language / Character .
Any help would be much appreciated.
Thanks
HarshadCheers Mate , You are a Star ,
Thanks Once again .
Regards
Harshad -
Data Services Designer - Problem when inserting rows in a database
Hi everyone!!!
I created a simple job that queries an Oracle database and writes the data returned from the query in a database as mysql.
The problem is that only one row is being written in the database, being that the return of my query has more than one row.What product ad what version you are running and what environment you are in?
Are you also getting some error?
BAshir Awan -
Problem when inserting xml flow into jspx page
When I drag and drop the xml into the jspx I should get a pop up menu where I would choose region (Im following a tutorial) but I get nothing. I drag and drop and It just opens it in the design editor.
I would appreciate any help you guys could giveOK, let cover the basics first:
JDev version?
I assume you are on 11.1.1.2.0 or 11.1.1.3.0:
You created a new task flow (right click on the 'Web content'->new->'ADF Task FLow'
the check box 'Createas Bounden Task flow was set and the check box for 'Create with Page Fragments' was set
The filename was something like 'search-email-flow.xml'
This should create a new bounden task flow with the name of search-email-flow (which creates a xml file with the same name).
Then you put one view to the flow. After creating the page fragment (the file created should have the jsff file type) you saved all work.
The you open up an existing jspx file and drag the new flow from the 'Page Flows' folder under 'Web content' onto the design view of the jspx file.
after dropping the flow you should then see the 'Create' dialog. e careful, you can't drop the flow everywhere on the page. You should drop in into a panel group or some other container. If you drop it i.e. onto a table you see the effect you described: it's opening the flow!
Timo -
Mutating Problem when insert while selecting data from dual
Hi All,
we have a table
test (
ID NUMBER
NAME VARCHAR2(100)) and a before insert trigger
create or replace trigger test1
before insert on test
for each row
begin
select decode(max(id),null,1,max(id)+1) into :new.id from test;
end;
i am able to insert values by using
"insert into test(name) values('test1')" with out any issues.
when i am inserting the values
"insert into test(name) select 'test1' from dual" i am getting error
ORA-04091: table SCOTT.TEST is mutating, trigger/function may not see it
Could someone please advice why i am getting error in second scenario.
Thanks in Advance
PrasadPrasad
try
insert into test (name) values ((select 'test1' from dual));
Frank -
Problem when recording the data using BDC for Tcode CJ02.
Dear Experts,
When i am trying to record the data for TCODE : CJ02 i need to enter the project Definition and enter the WBS element it takes me to the screen then i should select the WBS element and attach a file for that selected WBS element . The option for me to attach the attachment of file will be available on the application area(Services for the Object).
Now the problem when i try to do recording in SHDB this option like create attachement is not visible in the recodring . Kindly suggest me what can i do such that i attach the file for the particular project def and WBS element.
Either suggest any function module or other procedure .......
Regards,
Sana.Hi,
in BDC each and every action is recording. If your press enter in same screen that also recorded once aging may be this is your case repeating field values will appear. we can solve the problem for repeat fields like below.
suppose in your excel having repeated field X1 X2 X3 the X2 contains repeated field X3 means delete the X3 field.
Now In your itab having X1 and X2 fields. While in the LOOP the ITAB pass the X2 field to repeated the fields.
LOOP at ITAB to WA.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'BDC_CURSOR'.
bdcdata_wa-fval = 'RM08M-EBELN'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'INVFO-BLDAT'.
bdcdata_wa-fval = wa-X2." 1st time pass the X2 fields
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'INVFO-BLDAT'.
bdcdata_wa-fval = wa-X2." pass the same value to repeated field
APPEND bdcdata_wa TO bdcdata_tab.
Endloop.
Hope you can understand.
Regards,
Dhina..
Maybe you are looking for
-
Hi everybody, First of all I was not one of iTues users till by chance discovered its amazing features of downloading all kinds of items that help in education in particular. I set up iTunes version 8 I gusse and it was working properly either by usi
-
Prolong backlit time display in iPod Classic
Gentlefolk; The display on my iPod Classic defaults to current time and battery status. Perfect. But, to see the time, when I touch a control, the backlight comes on, then the song title displays, when all I really want to do is see the time. Is ther
-
Copying Dynamic Internal Table
Hi All, I have created a Dynamic internal table using field symbols. Now i need to copy that dynamic itab to another internal table, because I am not familiar with field symbols. Can anybody tell me how can i copy that dyn_itab to another it
-
Error when trying use the Maintenance Optimizer Transaction
I have finally gotten through a major headache setting up a SM box, but now when I try to use the maintenance Optimizer, i get the following messages and it won't go any further. Information Procedure 8000000051 Saved Warning Status was reset by syst
-
Soundfonts with multiple instruments
I've successfully installed some soundfonts in GarageBand but I'm having trouble with soundfonts that contain more than one instrument. I don't see how to get past the "first" or "default" instrument in the soundfont. How do I access the other instru