0% found this document useful (0 votes)
571 views3 pages

ADF Get Sequence Next Value

This document discusses two ways to work with dates in Oracle Application Framework (OAF): 1. Converting a date from one format to another, such as converting "15-Aug-2012" to "12/08/15". 2. Getting an Oracle date format by parsing a string into a JBO date, such as parsing "15-Aug-2012" into an oracle.jbo.domain.Date. Code examples are provided to demonstrate programmatically converting date formats and parsing a string into a JBO date.

Uploaded by

Nageswara Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
571 views3 pages

ADF Get Sequence Next Value

This document discusses two ways to work with dates in Oracle Application Framework (OAF): 1. Converting a date from one format to another, such as converting "15-Aug-2012" to "12/08/15". 2. Getting an Oracle date format by parsing a string into a JBO date, such as parsing "15-Aug-2012" into an oracle.jbo.domain.Date. Code examples are provided to demonstrate programmatically converting date formats and parsing a string into a JBO date.

Uploaded by

Nageswara Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

ADF Get sequence next value

Get sequence next value in ADF Value Type : Expression Value : (new oracle.jbo.server.SequenceImpl("HR.XX_IMAGE_S",adf.object.getDBTransaction())).getSeque nceNumber()

Other options mentioned in http://hasamali.blogspot.com/2011/04/adf-bc-various-way-of-setting-sequence.html For Programmatic Approach in EoImpl

import oracle.jbo.server.SequenceImpl; ... protected void initDefaults() { super.initDefaults(); SequenceImpl sequence = new SequenceImpl("<YourSequenceName>",getDBTransaction()); DBSequence dbseq = new DBSequence(sequence.getSequenceNumber()); OR Number seqValue = (Number)sequence.getSequenceNumber(); populateAttributeAsChanged(<YourId>,dbseq }

OR Inside EOImpl Class @Override public void create(AttributeList attributeList) { super.create(attributeList); SequenceImpl seq = new SequenceImpl("LOG_SEQ", getDBTransaction()); Number seqNextval = seq.getSequenceNumber(); setId(seqNextval); } Posted by ADF OAF Tech at 3:20 PM No comments: Email ThisBlogThis!Share to TwitterShare to Facebook

Saturday, August 18, 2012


OAF Get Oracle Date FOrmat / Change Date Format
1) From one format to any other format eg. 15-Aug-2012 to 12/08/15 String dob; dob = "15-Aug-2012 "; final String OLD_FORMAT = "dd-MMM-yyyy"; final String NEW_FORMAT = "yy/MM/dd"; String NewDate ; NewDate = ""; if (dob != null) { try {

SimpleDateFormat OldDateFormat = new SimpleDateFormat(OLD_FORMAT); Date dt = OldDateFormat.parse(dob); OldDateFormat.applyPattern(NEW_FORMAT); NewDate = OldDateFormat.format(dt); } catch (ParseException e) { e.printStackTrace(); } } System.out.println("Reqd Date Format is :" + NewDate); 2) To get Oracle Date Format import java.util.Date; import java.text.DateFormat; import java.text.ParseException; // Inside PR or PFR String dob; dob = "15-Aug-2012 "; // Method Call oracle.jbo.domain.Date jboRateStart = castToJBODate(dob); System.out.println("JBO Date is :" + jboRateStart); public static oracle.jbo.domain.Date castToJBODate(String aDate) { DateFormat formatter; java.util.Date date; if (aDate != null) { try { formatter = new SimpleDateFormat("dd-MMM-yyyy"); //formatter = new SimpleDateFormat("MM/dd/yyyy"); date = formatter.parse(aDate); java.sql.Date sqlDate = new java.sql.Date(date.getTime()); oracle.jbo.domain.Date jboDate = new oracle.jbo.domain.Date(sqlDate); return jboDate; } catch (ParseException e) { e.printStackTrace(); } } return null; } Output JBO Date is :2012-08-15

You might also like