Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CMP Entity bean and oracle function  RSS feed

 
Aj Mathia
Ranch Hand
Posts: 478
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want the entity bean to execute an oracle function i.e. initcap before inserting the field in the DB is there a way to do this within the entity level
ie without using a oracle trigger (db level)
or formating the string before setting the cmp field in core java land.

is there some way i can specify this in the config files.
Cheers
 
Vinay Raj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have two options. One use a BMP entity bean and invoke your function using CallableStatement and the appropriate CRUD(Create, Read, Update ,Delete) code in the bean. Option two is develop a stateless session bean maintain your CRUD operations using an entity bean and make a CallableStatement call to your function.
 
Aj Mathia
Ranch Hand
Posts: 478
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shouldn't there be an easier solution.
adding more beans means more maintainance.
currently my system uses a java method to format the String before using the entity bean.
I was wondering if there is anyway in the config files where i could tell the container to use function x on a cmp field.
Mark
any opinions??
 
Vinay Raj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt any application server will support such a functionality and if it does I am sure it will not be portable.
 
Sudd Ghosh
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a name-value pair config lookup facility in your framework, you can easily include the SQL procedure name (can be stored proc) in the config and perform a lookup from any persistence layer, can be home grown POJO persistence, SLSB or entity bean - and then execute the CallableStatement.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!