Groovy expression for assigning DB Sequence value to a String type attribute
You can use Groovy expression to default value for Key attribute from a database sequence while you create new instance of an entity object. If you have access to my book Oracle ADF Real World Developer’s Guide, see page 76 for details or see the following blog from Timo Hahn http://tompeez.wordpress.com/2011/09/02/using-groovy-expression-to-set-a-primary-key-with-a-sequence-number/
This post is just meant for sharing a simple tip that I learned today(Thanks to Steve Muench) for assigning database sequence value to a String type attribute. In case if you need to assign the sequence value to an attribute of type String in an entity object(yes, there are such use cases as well), you can add "as String" to the end of the Groovy expression and set it as default value for the entity attribute.
Example:
(new oracle.jbo.server.SequenceImpl("DEPARTMENTS_SEQ", adf.object.getDBTransaction())).getSequenceNumber() as String
This post is just meant for sharing a simple tip that I learned today(Thanks to Steve Muench) for assigning database sequence value to a String type attribute. In case if you need to assign the sequence value to an attribute of type String in an entity object(yes, there are such use cases as well), you can add "as String" to the end of the Groovy expression and set it as default value for the entity attribute.
Example:
(new oracle.jbo.server.SequenceImpl("DEPARTMENTS_SEQ", adf.object.getDBTransaction())).getSequenceNumber() as String
Hi! I was much time to spend your post, it is very impressed to me. so I am regularly following your post. I would like more ideas from your blog...
ReplyDeletePrimavera Training in Chennai
Primavera Course in Chennai
Excel Training in Chennai
Corporate Training in Chennai
Embedded System Course Chennai
Linux Training in Chennai
Tableau Training in Chennai
Spark Training in Chennai
Oracle Training in Chennai
I am happy to find this post Very useful for me, as it contains lot of information
ReplyDeleteindiaunimagined
Education
One of the best blogs, where I collected valuable things to know.
ReplyDeleteTally Course in Madurai
Tally Training in Madurai
Tally Course in Coimbatore
Tally Training Coimbatore
Tally Classes in Coimbatore
Tally Training Institute in Coimbatore
A good blog for the people who really needs information about this. Good work keep it up.
ReplyDeletechocolatesanddreams
Article submission sites
The blog is very useful for me and everyone who needs to know about this topic. Thank you for it.
ReplyDeleteEmbedded Course in Coimbatore.
Embedded Training Institute in Coimbatore.
Embedded Training in Coimbatore
Best Embedded Training Institute in Coimbatore
Embedded Systems Course in Coimbatore
Embedded Systems Training in Coimbatore
It was really an interesting blog, Thank you for providing unknown facts.
ReplyDeleteAviation Academy in Chennai
Air hostess training in Chennai
Airport management courses in Chennai
Ground staff training in Chennai
Aviation Courses in Chennai
air hostess institute in Chennai
airline and airport management courses in Chennai
airport ground staff training courses in Chennai
Thank you for posting this amazing information.
ReplyDeletetally training center in delhi
tally training center in Noida