Help! how to use sequence in in Oracle
i have a table name account
and i want the id column used the sequence XJ.ID
so how to modfiy the .jdo file?
here is the .jdo file
<?xml version="1.0" encoding="UTF-8"?>
<jdo>
<package name="test">
<class name="Account" objectid-class="AccountId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="XJ.ACCOUNT"/>
<field name="accountDetails">
<collection element-type="AccountDetail"/>
<extension vendor-name="kodo" key="inverse"
value="account"/>
<extension vendor-name="kodo" key="inverse-owner"
value="account"/>
</field>
<field name="accountNo">
<extension vendor-name="kodo" key="data-column"
value="ACCOUNT_NO"/>
</field>
<field name="balance">
<extension vendor-name="kodo" key="data-column"
value="BALANCE"/>
</field>
<field name="createDate">
<extension vendor-name="kodo" key="data-column"
value="CREATE_DATE"/>
</field>
<field name="id" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="ID"/>
</field>
<field name="modifyDate">
<extension vendor-name="kodo" key="data-column"
value="MODIFY_DATE"/>
</field>
<field name="name">
<extension vendor-name="kodo" key="data-column"
value="NAME"/>
</field>
</class>
thanks.
With Kodo 2.5, you cannot use a database sequence when using application
identity.
Instead, you should use datastore identity, and use the
sequence-factory-class metadata extension or the
com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass configuration property.
See the following URLs for details:
http://docs.solarmetric.com/ref_guide_meta_class.html#meta-class-sequence
http://docs.solarmetric.com/ref_guide_conf_kodo.html#com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass
-Patrick
jian xu wrote:
i have a table name account
and i want the id column used the sequence XJ.ID
so how to modfiy the .jdo file?
here is the .jdo file
<?xml version="1.0" encoding="UTF-8"?>
<jdo>
<package name="test">
<class name="Account" objectid-class="AccountId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="XJ.ACCOUNT"/>
<field name="accountDetails">
<collection element-type="AccountDetail"/>
<extension vendor-name="kodo" key="inverse"
value="account"/>
<extension vendor-name="kodo" key="inverse-owner"
value="account"/>
</field>
<field name="accountNo">
<extension vendor-name="kodo" key="data-column"
value="ACCOUNT_NO"/>
</field>
<field name="balance">
<extension vendor-name="kodo" key="data-column"
value="BALANCE"/>
</field>
<field name="createDate">
<extension vendor-name="kodo" key="data-column"
value="CREATE_DATE"/>
</field>
<field name="id" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="ID"/>
</field>
<field name="modifyDate">
<extension vendor-name="kodo" key="data-column"
value="MODIFY_DATE"/>
</field>
<field name="name">
<extension vendor-name="kodo" key="data-column"
value="NAME"/>
</field>
</class>
thanks.
Similar Messages
-
How to Use Sequence created in Oracle Database in SQL Ldr Control file
Hi,
I created a sequence in oracle database. How will use the sequence in SQL loader Control file.
Thanks in advanceHi,
You might get a good response to your post in the forum dedicated to data movement , including SQL*Loader . You can find it here Export/Import/SQL Loader & External Tables
Regards, -
How to use unicode fonts in Oracle forms 10g?
Hi I am working in forms 10g for quite a long time, the software that I have developed so far are all in English language. Now I have requirements to use Bengali Fonts in Forms 10g. I am facing difficulties doing that. Please reply with help. Thanks
Hasan Al MamunCheck this forum post (though that is for 6i, it would be of helpful for you)
How to use unicode fonts in Oracle forms 10g?
-Arun -
How to use crystal reports in oracle Jdeveloper
Hi,
I was implemented crystal reports in Crystal reports for eclipse also i made .rpt & .JSP how to use these file in oracle JDeveloper 10 g
can any one please help regarding this matter send any information if avilable send me on my mail My mail id: - [email protected]
Thank you !
regards,
Amolyou are in the Oracle Forms Forum and your question is related to JDeveloper and Crystal Reports, you think those two are linked to Oracle Forms in anyway??
Please post your questions in the appropriate Forum.
Tony -
Want to use sequence object of oracle when loading data in sql loader
Hi,
I want to use sequence when loading data in sqll loader, but the problem is i could not use sequence object of oracle to load the data by sql loader, i can use sequence of sql loader.
I want to use sequence object because in later entries this sequence object will be used.If i use sequence of sql loader how can i use oracle sequence object
Is there any other optionI have a simillar problem, I also want to use a sequence when loading data by the SQL Loader.
My control file is:
load data
infile '0testdata.txt'
into table robertl.tbltest
fields terminated by X'09'
trailing nullcols
(redbrojunos,
broj,
dolazak,
odlazak nullif odlazak=blanks,
komentar nullif komentar=blanks)
And the datafile is:
robertl.brojilo.nextval 1368 17.06.2003 08:02:46 17.06.2003 16:17:18
robertl.brojilo.nextval 2363 17.06.2003 08:18:18 17.06.2003 16:21:52
robertl.brojilo.nextval 7821 17.06.2003 08:29:22 17.06.2003 16:21:59
robertl.brojilo.nextval 0408 17.06.2003 11:20:27 17.06.2003 18:33:00 ispit
robertl.brojilo.nextval 1111 17.06.2003 11:30:58 17.06.2003 16:09:34 Odlazak na ispit
robertl.brojilo.nextval 6129 17.06.2003 14:02:42 17.06.2003 16:23:23 seminar
But all records were rejected by the Loader, for every record I get the error:
Record 1: Rejected - Error on table ROBERTL.TBLTEST, column REDBROJUNOS.
ORA-01722: invalid number -
How to use java source in Oracle when select by sqlplus.
How to use java source in Oracle when select by sqlplus.
I can create java source in Oracle
import java.util.*;
import java.sql.*;
import java.util.Date;
public class TimeDate
public static void main(String[] args)
public String setDate(int i){
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(new Date((long)i*1000));
System.out.println("Dateline: "
+ calendar.get(Calendar.HOUR_OF_DAY) + ":"
+ calendar.get(Calendar.MINUTE) + ":"
+ calendar.get(Calendar.SECOND) + "-"
+ calendar.get(Calendar.YEAR) + "/"
+ (calendar.get(Calendar.MONTH) + 1) + "/"
+ calendar.get(Calendar.DATE));
String n = calendar.get(Calendar.YEAR) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.DATE);
System.out.print(n);
return n;
I have table name TEST
ID DATE_IN
1 942685200
2 952448400
When I write jsp I use method setDate in class TimeDate
The result is
ID DATE_IN
1 1999/11/16
2 2003/7/25
Thanks you very much.It is unclear where you are having a problem. Is your issue at runtime (when the form runs in the browser) or when working in the Builder on the form?
Also be aware that you will need to sign your jar and include some new manifest entries. Refer to the Java 7u51 documentation and blogs that discuss the changes.
https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias
http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/manifest.html -
Help : Unable to use Java Beans in Oracle forms 6i
Hi ,
I have been trying to run few sample code to understand how to use Java beans in oracle forms 6i .But have been largely unsuccessfull.
It will be great if somebody can provide me with some simple form( and java code )which uses java beans concept to give some data to the java program and receive some data from it . Pls inform me about the settings that need to be done.
If you guys know it then pls take the pains of writing a simple form and java code.
i hope somebody will respond because your reply is very necesary for me to proceed.
U can email me the code > [email protected]
Thanks in advance.Thanks for your reply Francois.
Actually i am not facing problem understanding the programming technique.
I think the problem at my end is more of a cofiguration one.I am using forms version 6i
on oracle 8.
Every time i set the imlementation class property of the bean area it gives an error 13010 which translates to that "the class being mentioned is not extending the IView class".
The class i have written extends VBean so i am not sure why this error is occuring.
I think if oracle (correctly) finds the java class to use then i will be able to proceed.
Pls reply.
If you have some code that is working fine then pls send it to me.And also inform is some environment variables have to be set for its use. -
Need help how to use itunes card to download music
Need help how to use itunes card to download music
If you want to add the iTunes card to your account, then in the iTunes app on the iPad you should be able to scroll to the bottom of the Music tab and there should be a Redeem button - there is more info here : http://support.apple.com/kb/HT1574
-
How to Use Sequence in Oracle Views
Hi ,
I have created a view which gives the information about the access rights which a Resource has got. for ex -
Res1 - GYM access - member
Res1 - Swimingpool Access - member
I need to identify a Primary Key for this data set. So i thought that i'll use a Sequence to generate an extra column in this view.
But when i'm using the Sequence i'm getting the following error - "ORA-02287".you can use sequence within view it doesnot returned error;
create sequence t1_seq MAXVALUE 150
START WITH 39 INCREMENT BY 1;
SQL> insert into t1_view values(t1_seq.nextval,'dd');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
ID NA
10 aa
20 bb
30 cc
40 dd
4 rows selected.
SQL> insert into t1_view values(t1_seq.nextval,'ee');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
ID NA
10 aa
20 bb
30 cc
40 dd
41 ee
5 rows selected. -
MAX(SummaryNum) +1 bad idea, but how to use sequence part composite column
Hi,
My relational mode is as follows
Policy (policynum PK) has 1:M with Summary (policynum FK, SummaryNum part of PK, other columns part of PK)
Basically for each policy users can enter notes with SummaryNum 1, 2, 3, 4.... These numbers are shown to the user for tracking purpose. I need to make sure summary notes for EACH policy start with 1 (cannot really use sequence in the table in the strictest sense) and are incremented by 1. The current Oracle form basically creates the next highest possible value of SummaryNum by adding one to the currently available highest value. In brief, it is like a sequence number for summaries of a particular policy in the summary table.
PRE-INSERT
SELECT MAX(SummaryNum ) + 1
FROM Summary
I am trying to replicate this in ADF BC (using 11g) and know that not using sequencing and adding one to get the next number is a very bad idea due to concurrency challenges (transactional ACID properties). The reasons are as follows.
• Using MAX(policy_memo_seq_num) + 1 is not scalable,
• It will lead to duplicates in a multi-user environment, whether ADF BC, Oracle Forms, or any other technology
I also know how to use create a sequence in db, a related trigger, and then set the attribute in EO properties as DBSequence. My challenge is that since SummaryNum is not a primary key, and instead is part of a composite key in my case, how do I make sure that summary notes for EACH policy start with 1 in the Summary Table.
I appears that i cannot really use sequence in the table in the strictest sense as this will mean that for policies the summaryNum will start from the next available sequence number, but what i really want is to have it start by one for all policies.*
I would appreciate any help.
Thanks,Not sure if there is a better way, but here is one way. Let's say your table was like this:
SQL> desc versioned_item
Name Null? Type
ID NOT NULL NUMBER
VERSION NOT NULL NUMBER
DESCRIPTION VARCHAR2(20)and lets say your data looked like this:
SQL> select * from versioned_item order by id, version
ID VERSION DESCRIPTION
1001 1 Item 1001
1001 2 Item 1001
1001 3 Item 1001
1002 1 Item 1002
1002 2 Item 1002
1003 1 Item 1003To select only the rows for the max-version-id, you could do this:
select id, version,description
from versioned_item
where (id,version) in (select id,max(version) from versioned_item group by id)
order by id
ID VERSION DESCRIPTION
1001 3 Item 1001
1002 2 Item 1002
1003 1 Item 1003To capture this as a view object, you'd only just need to paste in the WHERE clause above into the Where clause box of the view object. No need to use expert-mode since you're not changing the select list or from clause. -
Hi,
I have an Empno Column, At the time of Opening a Form The Empno Will be displayed by using Sequence.
If the User doesn't save the Form Then the Empno Generated number will be changed.
How to write the code to get sequence numbers at Empno columns by using Sequence?
Thanks & Regards,
Hari BabuOk, I understand now your question. Since the oracle sequence is commited in a separate transaction, it is not possible to get the no-gap sequence, considering your example. In the other hand, if you don't commit immediately, than two concurrently opened forms could use the same sequence number, so you'll get the duplicate key!
If you're sure that this couldn't happen, you can manage your own sequencing, storing them in another table. Let's say you reached seq 999: entering the form, you'll read from your sequence table 1000, increment to 1001, and assign it to empno, but without commiting. Next time, you'll get the same number, until you commit form, and at the same time, change in seq table. So another will get 1001.
Downside of this approach are, as mentioned before, concurrent sessions, which will get the same sequence. -
How to use pool connection run oracle procedure?
Hi, All:
I am facing a difficulty I can not find the solution. Maybe you can help
me.
I want to call an oracle stored procedure whenever I talk to datebase to
make the application more efficient. I was able to run the procedure using
oracle thin driver but not the connection pool using Weblogic jDriver for
JDBC2.0.
Please check the following code and see what I did wrong:
The code in JSP file in Weblogic:
<%-- JSP page directive --%>
<%@ page
import="java.io.*,java.util.*,java.sql.*,weblogic.common.*,weblogic.jdbc20.c
ommon.*" %>
<%-- JSP Declaration --%>
<%!
protected Connection con = null;
ResultSet rset = null;
%>
<%-- JSP Scriptlet --%>
<% try {
Properties props = new Properties();
props.setProperty("user", "james");
props.setProperty("password", "aimjames");
Driver myDriver =
(Driver) Class.forName
("weblogic.jdbc.pool.Driver").newInstance();
con = myDriver.connect("jdbc:weblogic:pool:hdj2Pool", props);
String userid = (String)session.getAttribute("user.id");
int subid =
Integer.parseInt((String)session.getAttribute("sub.id"));
String query = "begin pkg_select.sel_req_in_001(" + userid +
", " + subid + ", ?); end;";
weblogic.jdbc.common.OracleCallableStatement cstmt =
(weblogic.jdbc.common.OracleCallableStatement)con.prepareCall(query);
cstmt.registerOutParameter(1,java.sql.Types.OTHER);
cstmt.execute();
rset = cstmt.getResultSet(1);
When I run this JSP file, the compilation is fine but the result shows
nothing. That's means I can not get the ResultSet for some reason.
The working file when I use oracle thin driver (NOT use a connection pool):
String userid = (String)session.getAttribute("user.id");
int subid = Integer.parseInt((String)session.getAttribute("sub.id"));
String query = "begin pkg_select.sel_req_in_001(" + userid +", " +subid
+", ?); end ";
CallableStatement cstmt = con.prepareCall(query);
cstmt.registerOutParameter(1,OracleTypes.CURSOR);
cstmt.execute();
ResultSet rset = (ResultSet)cstmt.getObject(1);
You may notice that I am trying to bind a parameter to an Oracle cursor. Is
there anything I did wrong in using weblogic API? I just want to let you
that in the weblogic JSP file, I also tried to use
weblogic.jdbc.oci.CallableStatement and
weblogic.jdbc20.oci.CallableStatement instead of
weblogic.jdbc.common.OracleCallableStatement, but none of them seems work.
I did check the bea site at
http://www.weblogic.com/docs51/classdocs/API_joci.html#1080420 for the
example to use:
cstmt.registerOutParameter(1,java.sql.Types.OTHER);
and I think I followed the exact procedure the example did.
Please help!
James Lee
Artificial Intelligence in Medicine, Inc.
2 Berkeley Street, Suite 403
Toronto, Ontario M5A 2W3
Tel: 416-594-9393 ext. 223
Fax: 416-594-2420
Email: [email protected]
Joseph
Thanks for the suggestion about latest version of Weblogic Server.
"coding best-practices" is not mentioned in the post.
In order to make servlet application run significantly faster, my servet how to use connection poo is much moreresonable?
It is reasonable to expect servlet to run significantly faster with connection pooling.
Is it true that geting and close a connection whenever
one time database access finished?
Already answered. Applications use a connection from the pool then return it when finished using the connection.
Will the solution affect the servlet performance?
Yes. Already answered. Connection pooling enhances performance by eliminating the costly task of creating database connections for the application.
Is there any official document to introduce connection pool program?
For the latest version
http://download.oracle.com/docs/cd/E17904_01/web.1111/e13726/toc.htm
http://download.oracle.com/docs/cd/E17904_01/web.1111/e13737/jdbc_datasources.htm#insertedID0 -
How to use sequence in MS sql server?
In Oracle DB we use sequence like that:
SequenceImpl s = new SequenceImpl("customer_seq", getDBTransaction());
Integer next = (Integer)s.getData();
setId(new Number(next.intValue()));
But there is no sequence in sql server ,how can I do?
Thank you~~MS SQLServer have a IDENTITY column property and UNIQUEIDENTIFIER data type that is somewhat similar to Oracle's sequence. I don't know whether your table contain either of these, or you just want to set sequential number to a column.
Below is some info about IDENTITY and UNIQUEIDENTIFIER you may already know since they are in SQLServer Book.
IDENTITY property: You can define IDENTITY property on a numeric column. You can set the seed and increment on this column property very much like Oracle's sequence. The only thing I think it does not have is the "nextval". You can use IDENT_CURRENT function or @@IDENTITY after an INSERT or SELECT INTO to get the last value generated. Of course you can use this value and add the increment to get the next
value but it not the same as seqname.nextval which keep incrementing each time you call it. Getting the current identity value and adding the increment your self will not work for multiple sessions with pending
insert. Another thing about column with IDENTITY property is that you cannot insert value into this column (i.e, omit it in your insert statement values) unless IDENTITY_INSERT is on, but only one table in a
session can have IDENTITY_INSERT to be turned on.
If you don't need to know the next seq value, then IDENTITY work similar to Oracle sequence. Execute select after postchanges or commit will have system generated values. If you need to get next value before insert, Sung suggest using SEQ_TABLE and managing the next value (write a database function to mimic Oracle'
s nextval).
UNIQUEIDENTIFIER datatype: UNIQUEIDENTIFIER is a 16-byte hexadecimal number indicating a globally unique identifier (GUID). The GUID is useful when a row must be unique among many other rows. You could use NEWID() to create a value of type uniqueidentifier or calling some API function that returns a GUID. The advantage of using uniqueidentifier is that the values generated by NEWID function or application GUID are guaranteed to be unique throughout the world. The disadvantage of using uniqueidetifier is that it is long and obscure, random, difficult for user to remember or type correctly. It is 16 byte, which is large compare to other datatype such as 4-byte integer.
Thanks,
Yvonne -
How to use Java Script in Oracle Forms 10g
Hello,
Appreciate if anyone could help me using Java Script in Oracle Forms 10g?
Thanks
GMThank you for your reply. I was reading on the metalink that we could use the to call the java script from oracle Forms 10g (Doc ID 265863.1)
Example:
WEB.SHOW_DOCUMENT ('javascript:void(window.open("http://www.oracle.com","","location=no,toolbar=no,menubar=no,status=no,"));self.close()','_blank');
I tried it but it did not open the any window as it claims. Am I missing anything? Is there any IE related setting which I need to modify for the above to work?
Regards
GM -
How to use decode function in oracle apex 3.2.1
Hello Friends,
how to use decode
var_decode := 'decode'||'('|| var1 ||','|| -800000000000000||','||'.A'||','||
appreciate your help.
regards/kumar
Edited by: kumar73 on Apr 23, 2010 12:25 PM
Edited by: kumar73 on Apr 23, 2010 12:27 PMHey just on this particular point, there's a handy PL/SQL method for escaping quotation characters which may reduce the complexity of the string.
For example, if I had a string:
I can't understand why quoting my 'quote' characters never seems to "work"!and I wanted to pass that into a variable, I could do this:
vc_foo:= 'I can''t understand why my ''quote'' characters never seems to "work"!';or I could use the q function, whereby you enclose your string within a quote delimiter of your choice, like so:
vc_foo:= q'^I can't understand why quoting my 'quote' characters never seems to "work"!^';
note: I used the caret (^) character by convention but any valid character will do
...all of which leaves your original string more or less unadulterated.
I find this particularly useful for generating dynamic SQL and dynamic PL/SQL, as it leave the query looking a tad more readable, although if you are chaining together multiple strings with double-pipes, it can make it a little muddier. I find it particularly useful if I'm going to deal with string data from, for example, a field with Irish-derived surnames such as "O'Reilly"...
Give it a go!
Maybe you are looking for
-
Retrieve a range of records from SQL query Oracle
I want to retrieve range of rows in Oracle database. This is the table structure: CREATE TABLE ACTIVESESSIONSLOG( ASESSIONID VARCHAR2(30 ) NOT NULL, USERID VARCHAR2(30 ), ACTIVITYSTART TIMESTAMP(6), ACTIVITYEND TIMESTAMP(6), ACTIVITY CLOB /
-
After installing Photoshop CS (version 8.0.1) activation does not work
Hi, after installation i try to activate the product. Following several phone numbers regarding activation at last i get redirected to this site. Only activation also doesn't work, with a message containing information that the online activation serv
-
I'm looking for a way to connect a laptop with screwless VGA to a tv that only has rca?
-
Hey I don't know if my mac book air is frozen, but the screen is gray with the apple logo in the middle of the gray screen, with the 'booting' icon turning round and round. I have switched it off fron both the power and power button on the computer,
-
For some reason I can't get firefox to load Google Calendar. It loads GMail and I can load google calendar if I use Internet Explorer, but not Firefox. I have uninstalled Firefox and installed but nothing works. Pleas help