<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL &#8211; Jitendra Zaa</title>
	<atom:link href="https://www.jitendrazaa.com/blog/category/sql/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.jitendrazaa.com/blog</link>
	<description>AI, Salesforce, ServiceNow &#38; Enterprise Tech Guides</description>
	<lastBuildDate>Thu, 09 Mar 2017 17:11:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">87744916</site><atom:link rel="search" type="application/opensearchdescription+xml" title="Search Jitendra Zaa" href="https://www.jitendrazaa.com/blog/wp-json/opensearch/1.1/document" />	<item>
		<title>SQL Server &#8211; Read all files in directory and store in Table</title>
		<link>https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-read-all-files-in-directory-and-store-in-table/</link>
					<comments>https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-read-all-files-in-directory-and-store-in-table/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Wed, 18 Jan 2017 21:13:22 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">http://www.jitendrazaa.com/blog/?p=5882</guid>

					<description><![CDATA[T-SQL Script to read all files in directory and store back in table - SQL Server]]></description>
										<content:encoded><![CDATA[<p style="text-align: justify;">Recently I was in need to analyze Salesforce debug log for one stubborn issue which was very hard to reproduce. Was able to download 1500+ debug logs on my system, however to analyze it, I decided to take help of <strong>SQL Server</strong>.</p>
<p style="text-align: justify;">Very soon I came into challenge to read all files in a directory and store it back in SQL Server table.</p>
<p style="text-align: justify;">Found very good article <a href="https://www.simple-talk.com/sql/t-sql-programming/the-tsql-of-text-files/">here</a> which helped me to come up with below queries. If you need to read more in detail about below T-SQL and stored procedures please navigate to original article.<span id="more-5882"></span></p>
<p><strong>Table where we need to load files</strong></p>
<pre class="brush: sql; title: ; notranslate">
CREATE TABLE &#x5B;dbo].&#x5B;DebugLogs](
	&#x5B;Id] &#x5B;numeric](18, 0) IDENTITY(1,1) NOT NULL,
	&#x5B;LogText] &#x5B;nvarchar](max) NULL,
	&#x5B;FileName] &#x5B;nchar](500) NULL
) ON &#x5B;PRIMARY] TEXTIMAGE_ON &#x5B;PRIMARY]
</pre>
<p><strong>Stored procedure which reads all files in a directory</strong></p>
<pre class="brush: sql; title: ; notranslate">
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE &#x5B;dbo].&#x5B;ListPathsXML]
@FileSpec VARCHAR(2000),
@order VARCHAR (80) = '/O-D',--sort by date time oldest first
@xmlFileList XML OUTPUT
 
AS
DECLARE @myfiles TABLE (MyID INT IDENTITY(1,1) PRIMARY KEY, FullPath VARCHAR(2000))
DECLARE @CommandLine VARCHAR(4000)
IF @order IS NOT NULL -- abort if the order is silly
   BEGIN
   SELECT @CommandLine =LEFT('dir &quot;' + @FileSpec + '&quot; /A-D /B /S '+@order,4000)
   INSERT INTO @MyFiles (FullPath)
       EXECUTE xp_cmdshell @CommandLine
   DELETE FROM @MyFiles WHERE fullpath IS NULL
       OR fullpath = 'File Not Found'
   END
SET @xmlFileList = (SELECT fullpath FROM @MyFiles
                         FOR
                          XML PATH('thefile'),
                              ROOT('thefiles'),
                              TYPE)

</pre>
<p><strong>Stored procedure which reads content of file one at a time</strong></p>
<pre class="brush: sql; title: ; notranslate">
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE &#x5B;dbo].&#x5B;spLoadTextFromAFile]
   @Filename VARCHAR(255),
   @Unicode INT = 0
AS 
   SET NOCOUNT ON
   DECLARE @MySpecialTempTable VARCHAR(255)
   DECLARE @Command NVARCHAR(4000)
   DECLARE @RESULT INT

--firstly we create a global temp table with a unique name
   SELECT   @MySpecialTempTable = '##temp' 
       + CONVERT(VARCHAR(12), CONVERT(INT, RAND() * 1000000))
--then we create it using dynamic SQL, 
   SELECT   @Command = 'create table &#x5B;' 
       + @MySpecialTempTable + '] (MyLine '
       + CASE WHEN @unicode &lt;&gt;0 THEN 'N' ELSE '' END +'varchar(MAX))
 '
   EXECUTE sp_ExecuteSQL @command

   SELECT   @command = 'bulk insert &#x5B;' 
       + @MySpecialTempTable + '] from' + ' ''' 
       + REPLACE(@Filename, '&quot;', '') + '''' 
       + ' with (FIELDTERMINATOR=''|~||''' + ',ROWTERMINATOR = ''
'''        + CASE WHEN @unicode &lt;&gt;0 THEN ', DATAFILETYPE=''widechar'''ELSE '' END
       + ')'
-- import the data
   EXEC (@Command)
   EXECUTE ('Select * from ' + @MySpecialTempTable)
   EXECUTE ('Drop table ' + @MySpecialTempTable)
</pre>
<p style="text-align: justify;"><strong>Final T-SQL query to read content of every file exists in directory and store in Table in SQL Server</strong></p>
<pre class="brush: sql; title: ; notranslate">
DECLARE
       @ii INT,
       @iiMax INT,
       @File VARCHAR(2000)
DECLARE @files TABLE (MyID INT IDENTITY(1,1) PRIMARY KEY, &#x5B;Path] VARCHAR(2000))
DECLARE @lines TABLE (MyID INT IDENTITY(1,1) PRIMARY KEY, &#x5B;line] NVARCHAR(MAX), fName nVARCHAR(200))
 
DECLARE @FileList XML
EXECUTE ListPathsXML 'C:\ForceUtil\18_Jan_2017\DebugLogs\',
    DEFAULT , @XMLFileList = @FileList OUTPUT
 
INSERT INTO @files(path)
   SELECT   x.thefile.value('fullpath&#x5B;1]', 'varchar(2000)') AS &#x5B;path]
        FROM    @FileList.nodes('//thefiles/thefile') AS x ( thefile )
DELETE FROM @files WHERE REVERSE(path) LIKE 'golrorre%'
--don't look at the current errorlog!
SELECT @ii=1, @iiMax=MAX(MyID) FROM @Files
WHILE @ii&lt;=@iiMax
   BEGIN
   SELECT @File= &#x5B;path] FROM @files WHERE MyID=@ii
   INSERT INTO @lines(line)
       EXECUTE spLoadTextFromAFile @file, @Unicode=1

   INSERT INTO &#x5B;dbo].&#x5B;DebugLogs] (LogText, &#x5B;FileName])
	SELECT  Line, @file FROM @lines
   
   --Empty temp table
   Delete FROM @lines

   SELECT @ii=@ii+1
   END
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-read-all-files-in-directory-and-store-in-table/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5882</post-id>	</item>
		<item>
		<title>Export Documents saved as Blob / Binary from SQL Server</title>
		<link>https://www.jitendrazaa.com/blog/sql/sqlserver/export-documents-saved-as-blob-binary-from-sql-server/</link>
					<comments>https://www.jitendrazaa.com/blog/sql/sqlserver/export-documents-saved-as-blob-binary-from-sql-server/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Sat, 24 Dec 2016 02:05:23 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">http://www.jitendrazaa.com/blog/?p=5873</guid>

					<description><![CDATA[T-SQL Scripts to Export Blob or Binary data stored in SQL Server]]></description>
										<content:encoded><![CDATA[<p style="text-align: justify;">I tried many ways to export files or documents saved as binary (Blob) datatypes in SQL Server. However, finally came up with below solution which worked very well. Below script was used to export around 25GB of files stored in SQL Server.</p>
<p style="text-align: justify;">To understand this, lets create a table in Database which will store files from local system into SQL Server as binary / Blob .</p>
<pre class="brush: sql; title: ; notranslate">
CREATE TABLE &#x5B;dbo].&#x5B;Document](
	&#x5B;Doc_Num] &#x5B;numeric](18, 0) IDENTITY(1,1) NOT NULL,
	&#x5B;Extension] &#x5B;varchar](50) NULL,
	&#x5B;FileName] &#x5B;varchar](200) NULL,
	&#x5B;Doc_Content] &#x5B;varbinary](max) NULL
) ON &#x5B;PRIMARY] TEXTIMAGE_ON &#x5B;PRIMARY]
</pre>
<h3>How to Insert Blob into Database</h3>
<p>For demo purpose, we will save two files in our table using below queries</p>
<pre class="brush: sql; title: ; notranslate">
INSERT &#x5B;dbo].&#x5B;Document] (&#x5B;Extension] ,&#x5B;FileName] , &#x5B;Doc_Content] )
SELECT 'pdf', 'Salesforce Lightning.pdf',&#x5B;Doc_Data].*
FROM OPENROWSET 
    (BULK 'C:\G2\My POC\Blog\SQL Server\Source\lightning.pdf', SINGLE_BLOB)  &#x5B;Doc_Data]

INSERT &#x5B;dbo].&#x5B;Document] (&#x5B;Extension] ,&#x5B;FileName] , &#x5B;Doc_Content] )
SELECT 'html', 'Progress.html',&#x5B;Doc_Data].*
FROM OPENROWSET 
    (BULK 'C:\G2\My POC\Blog\SQL Server\Source\Progress.html', SINGLE_BLOB)  &#x5B;Doc_Data]
</pre>
<p>If we try to see content in actual table, it will look like</p>
<figure id="attachment_5874" aria-describedby="caption-attachment-5874" style="width: 637px" class="wp-caption aligncenter"><a href="https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/12/Insert-Blob-into-Database.png?ssl=1"><img data-recalc-dims="1" decoding="async" class="size-full wp-image-5874" src="https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/12/Insert-Blob-into-Database.png?resize=637%2C67&#038;ssl=1" alt="Insert Blob into Database" width="637" height="67" srcset="https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/12/Insert-Blob-into-Database.png?w=637&amp;ssl=1 637w, https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/12/Insert-Blob-into-Database.png?resize=300%2C32&amp;ssl=1 300w" sizes="(max-width: 637px) 100vw, 637px" /></a><figcaption id="caption-attachment-5874" class="wp-caption-text">Insert Blob into Database</figcaption></figure>
<h3>Export Blob From SQL Server and save it as a file</h3>
<p style="text-align: justify;">For demo purpose, we want to save documents on local disc. We will use <em>Doc_Num </em> to be created as folder and document will be saved in that folder. To create folders using SQL Server, <a href="https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-create-folders-using-t-sql-ole-automation/">we will use stored procedure <em>CreateFolder</em> created in this post</a>.<br />
<em>Note : We will create only one folder per document. If multiple nested folder needs to be created then we need to iterate through each folder and call </em>CreateFolder<em> stored procedure for each folder. Its explained <a href="https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-create-folders-using-t-sql-ole-automation/">in this blog post</a>.</em></p>
<p style="text-align: justify;">Now time to see actual T-SQL which will iterate through all documents, create folder and save Blob as a file on local disc.</p>
<pre class="brush: sql; title: ; notranslate">
USE &#x5B;POC]
DECLARE @outPutPath varchar(50) = 'C:\G2\My POC\Blog\SQL Server\Extract Blob'
, @i bigint
, @init int
, @data varbinary(max) 
, @fPath varchar(max)  
, @folderPath  varchar(max) 
 
--Get Data into temp Table variable so that we can iterate over it 
DECLARE @Doctable TABLE (id int identity(1,1), &#x5B;Doc_Num]  varchar(100) , &#x5B;FileName]  varchar(100), &#x5B;Doc_Content] varBinary(max) )
 
INSERT INTO @Doctable(&#x5B;Doc_Num] , &#x5B;FileName],&#x5B;Doc_Content])
Select &#x5B;Doc_Num] , &#x5B;FileName],&#x5B;Doc_Content] FROM  &#x5B;dbo].&#x5B;Document]
 
--SELECT * FROM @table

SELECT @i = COUNT(1) FROM @Doctable
 
WHILE @i &gt;= 1
BEGIN 

	SELECT 
	 @data = &#x5B;Doc_Content],
	 @fPath = @outPutPath + '\'+ &#x5B;Doc_Num] + '\' +&#x5B;FileName],
	 @folderPath = @outPutPath + '\'+ &#x5B;Doc_Num]
	FROM @Doctable WHERE id = @i
 
  --Create folder first
  EXEC  &#x5B;dbo].&#x5B;CreateFolder]  @folderPath
  
  EXEC sp_OACreate 'ADODB.Stream', @init OUTPUT; -- An instace created
  EXEC sp_OASetProperty @init, 'Type', 1;  
  EXEC sp_OAMethod @init, 'Open'; -- Calling a method
  EXEC sp_OAMethod @init, 'Write', NULL, @data; -- Calling a method
  EXEC sp_OAMethod @init, 'SaveToFile', NULL, @fPath, 2; -- Calling a method
  EXEC sp_OAMethod @init, 'Close'; -- Calling a method
  EXEC sp_OADestroy @init; -- Closed the resources
 
  print 'Document Generated at - '+  @fPath   

--Reset the variables for next use
SELECT @data = NULL  
, @init = NULL
, @fPath = NULL  
, @folderPath = NULL
SET @i -= 1
END
</pre>
<p style="text-align: justify;">Variable <em>@outPutPath</em> stores root folder path, where folders will be created and Blob content would be exported into it as a file.</p>
<p style="text-align: justify;">Below image shows output in action :</p>
<figure id="attachment_5875" aria-describedby="caption-attachment-5875" style="width: 770px" class="wp-caption aligncenter"><a href="https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/12/SQL-Server-Export-Blob.gif?ssl=1"><img data-recalc-dims="1" fetchpriority="high" decoding="async" class="size-full wp-image-5875" src="https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/12/SQL-Server-Export-Blob.gif?resize=770%2C720&#038;ssl=1" alt="SQL Server Export Blob as File" width="770" height="720" /></a><figcaption id="caption-attachment-5875" class="wp-caption-text">SQL Server Export Blob as File</figcaption></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/sql/sqlserver/export-documents-saved-as-blob-binary-from-sql-server/feed/</wfw:commentRss>
			<slash:comments>56</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5873</post-id>	</item>
		<item>
		<title>SQL Server – Search complete database for value</title>
		<link>https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-search-complete-database-for-value/</link>
					<comments>https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-search-complete-database-for-value/#respond</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Sat, 26 Nov 2016 05:29:19 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">http://www.jitendrazaa.com/blog/?p=5828</guid>

					<description><![CDATA[Search complete Database in SQL Server for some value]]></description>
										<content:encoded><![CDATA[<p>Recently, I was in need to search complete Database for some value and found below very useful script (T-SQL)</p>
<pre class="brush: sql; title: ; notranslate">
DECLARE @SearchStr nvarchar(100) = 'SEARCHSTRING'
DECLARE @Results TABLE (ColumnName nvarchar(370), ColumnValue nvarchar(3630))

SET NOCOUNT ON

DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET  @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')


WHILE @TableName IS NOT NULL

BEGIN
    SET @ColumnName = ''
	BEGIN TRY
    SET @TableName = 
    (
        SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
        FROM     INFORMATION_SCHEMA.TABLES
        WHERE         TABLE_TYPE = 'BASE TABLE'
            AND    QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) &gt; @TableName
            AND    OBJECTPROPERTY(
                    OBJECT_ID(
                        QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
                         ), 'IsMSShipped'
                           ) = 0
    )
END TRY
BEGIN CATCH
END CATCH
    WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)

    BEGIN
        SET @ColumnName =
        (
            SELECT MIN(QUOTENAME(COLUMN_NAME))
            FROM     INFORMATION_SCHEMA.COLUMNS
            WHERE         TABLE_SCHEMA    = PARSENAME(@TableName, 2)
                AND    TABLE_NAME    = PARSENAME(@TableName, 1) 
                AND    QUOTENAME(COLUMN_NAME) &gt; @ColumnName 
        )
         

        IF @ColumnName IS NOT NULL

        BEGIN
            INSERT INTO @Results
            EXEC
            (
                'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 4000) 
                FROM ' + @TableName + ' (NOLOCK) ' +
                ' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
            )
        END
    END    
END

SELECT ColumnName, ColumnValue FROM @Results
</pre>
<p>If we run above script for word &#8216;king&#8217; then output in below format will be displayed<span id="more-5828"></span></p>
<figure id="attachment_5829" aria-describedby="caption-attachment-5829" style="width: 377px" class="wp-caption aligncenter"><a href="https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/11/SQL-Server-search-database-for-value-Output.png?ssl=1"><img data-recalc-dims="1" decoding="async" class="size-full wp-image-5829" src="https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/11/SQL-Server-search-database-for-value-Output.png?resize=377%2C293&#038;ssl=1" alt="SQL Server search database for value - Output" width="377" height="293" srcset="https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/11/SQL-Server-search-database-for-value-Output.png?w=377&amp;ssl=1 377w, https://i0.wp.com/www.jitendrazaa.com/blog/wp-content/uploads/2016/11/SQL-Server-search-database-for-value-Output.png?resize=300%2C233&amp;ssl=1 300w" sizes="(max-width: 377px) 100vw, 377px" /></a><figcaption id="caption-attachment-5829" class="wp-caption-text">SQL Server search database for value &#8211; Output</figcaption></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-search-complete-database-for-value/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5828</post-id>	</item>
		<item>
		<title>SQL Server – Create Folders using T-SQL &#038; OLE automation</title>
		<link>https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-create-folders-using-t-sql-ole-automation/</link>
					<comments>https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-create-folders-using-t-sql-ole-automation/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Thu, 24 Nov 2016 03:39:00 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Stored Procedure]]></category>
		<guid isPermaLink="false">http://www.jitendrazaa.com/blog/?p=5824</guid>

					<description><![CDATA[Tutorial to create folders in SQL Server using Transact-SQL and OLE Automation Stored Procedures ]]></description>
										<content:encoded><![CDATA[<p style="text-align: justify;">SQL Server has some standard stored procedures that <a href="https://msdn.microsoft.com/en-us/library/ms190501.aspx">allow OLE automation</a>.</p>
<p style="text-align: justify;">First step, is to check whether Ole Automation Procedures are enabled in SQL Server or not ? It can be enabled by simply executing below T-SQL commands.</p>
<p><strong>T-SQL to enable Ole Automation Procedures in SQL Server</strong></p>
<pre class="brush: sql; title: ; notranslate">
        sp_configure 'show advanced options', 1;
	GO
	RECONFIGURE;
	GO
	sp_configure 'Ole Automation Procedures', 1;
	GO
	RECONFIGURE;
	GO
</pre>
<p style="text-align: justify;">Next step is to create a stored procedure, which will use an OLE Automation procedures and create a folder on system drive<span id="more-5824"></span></p>
<pre class="brush: sql; title: ; notranslate">
--	DATE	:	23-Nov
--	AUTHOR	:	Jitendra Zaa

CREATE PROCEDURE &#x5B;dbo].&#x5B;CreateFolder] (@newfolder varchar(1000)) AS  
BEGIN  
DECLARE @OLEfolder   INT  
DECLARE @OLEsource   VARCHAR(255)  
DECLARE @OLEdescription  VARCHAR(255) 
DECLARE @init   INT  
DECLARE @OLEfilesytemobject INT  
 
-- it will fail if OLE automation not enabled
EXEC @init=sp_OACreate 'Scripting.FileSystemObject', @OLEfilesytemobject OUT  
IF @init &lt;&gt; 0  
BEGIN  
	EXEC sp_OAGetErrorInfo @OLEfilesytemobject  
	RETURN  
END  
-- check if folder exists  
EXEC @init=sp_OAMethod @OLEfilesytemobject, 'FolderExists', @OLEfolder OUT, @newfolder  
-- if folder doesnt exist, create it  
IF @OLEfolder=0  
	BEGIN  
	EXEC @init=sp_OAMethod @OLEfilesytemobject, 'CreateFolder', @OLEfolder OUT, @newfolder  
END  
-- in case of error, raise it   
IF @init &lt;&gt; 0  
	BEGIN  
		EXEC sp_OAGetErrorInfo @OLEfilesytemobject, @OLEsource OUT, @OLEdescription OUT  
		SELECT @OLEdescription='Could not create folder: ' + @OLEdescription  
		RAISERROR (@OLEdescription, 16, 1)   
	END  
EXECUTE @init = sp_OADestroy @OLEfilesytemobject  
END  
</pre>
<p style="text-align: justify;">Its time to finally see OLE Automation in action. We would try to create three nested folders in <em>tmp </em>folder of <em>c </em>drive. Assumption is <em>c:\tmp </em>folder already exists.</p>
<p style="text-align: justify;">Below code iterates through string which contains folder path <em>@folderName</em> and iteratively it will create folders using stored procedure <em>CreateFolder</em>.</p>
<pre class="brush: sql; title: ; notranslate">
--Prerequisite , make sure that @path exists on drive
DECLARE @path varchar(80) = 'C:\tmp',
 @folderName varchar(100)= 'folder1\folder2\folder3\folder4',
 @fullPath varchar(500),
 @progressivePath varchar(500)

SET @fullPath = @path +'\'+@folderName
 
DECLARE @pos INT
DECLARE @len INT
DECLARE @curentFolder varchar(8000)
 
set @pos = 0
set @len = 0
SET @progressivePath = @path

--Loop through path and create folder iteratively
WHILE CHARINDEX('\', @folderName, @pos+1) &gt; 0
BEGIN
    set @len = CHARINDEX('\', @folderName, @pos+1) - @pos 
    set @curentFolder = SUBSTRING(@folderName, @pos, @len) 
	SET @progressivePath = @progressivePath + '\'+@curentFolder
    PRINT @progressivePath 
	EXEC CreateFolder @progressivePath
    set @pos = CHARINDEX('\', @folderName, @pos+@len) +1
END
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/sql/sqlserver/sql-server-create-folders-using-t-sql-ole-automation/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5824</post-id>	</item>
		<item>
		<title>Pagination and Switch Case in Where clause &#8211; SQL Server</title>
		<link>https://www.jitendrazaa.com/blog/sql/pagination-and-switch-case-in-where-clause-sql-server/</link>
					<comments>https://www.jitendrazaa.com/blog/sql/pagination-and-switch-case-in-where-clause-sql-server/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Sat, 19 May 2012 11:42:27 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=2861</guid>

					<description><![CDATA[Example of using pagination and switch case in where clause in SQL server]]></description>
										<content:encoded><![CDATA[<p style="text-align: justify;">After a long time i am going to write any article on SQL Server. That last article i think was before 18 months. As currently i am exploring the Salesforce and its API&#8217;s, i caught in situation to create a stored procedure and provide the offset feature, that means i needed the pagination support in my stored procedure. There is <span style="text-decoration: underline;">no direct keyword</span> available in SQL Server something like LIMIT in mysql. And therefore i thought to share my solution with community. So, here we go&#8230;</p>
<p style="text-align: justify;">I am considering that there will be table named &#8220;Employee&#8221; in which i want to search by employees <span style="text-decoration: underline;">firstName</span> with <span style="text-decoration: underline;">pagesize</span> and <span style="text-decoration: underline;">offset</span> attribute.<span id="more-2861"></span></p>
<p><span style="text-decoration: underline;"><strong>Table Structure for example:</strong></span></p>
<figure id="attachment_2863" aria-describedby="caption-attachment-2863" style="width: 380px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2012/05/SQL-Server-Employee-Table.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2863" title="SQL Server Employee Table" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2012/05/SQL-Server-Employee-Table.png?resize=380%2C121&#038;ssl=1" alt="SQL Server Employee Table" width="380" height="121" /></a><figcaption id="caption-attachment-2863" class="wp-caption-text">SQL Server Employee Table</figcaption></figure>
<p><span style="text-decoration: underline;"><strong>Create Stored Procedure:</strong></span></p>
<p>Below stored procedure demonstrates <strong>pagination</strong> as well as <strong>switch case</strong> in where clause.</p>
<pre class="brush: sql; title: ; notranslate">
-- Author	: Jitendra Zaa
-- Date		: 19 May 2012
-- Summary	: Search Employee on the basis of fName and lName and if the lName is blank then set
--			: default lName to search is 'Zaa'. Also there shpuld be support for pagination
CREATE PROCEDURE dbo.SearchEmployee
(
	@fName varchar(50), -- First Name to Search
	@lName varchar(50), -- Last Name to search, and if its blank then search for 'Zaa'
	@offset INT,		-- Starting rowNumber of record
	@pageSize INT		-- Number of records in Row
)
AS
	BEGIN

		SELECT * FROM
			(SELECT ROW_NUMBER() OVER(ORDER BY EmpId) AS row, --Generate Row Number
			EmpId,
			FirstName,
			LastName
		FROM
			Employee ) as e
		WHERE
			e.FirstName LIKE '%'+@fName+'%'
			AND
			e.LastName LIKE
			CASE
				WHEN @lName &lt;&gt; '' THEN '%'+@lName+'%'
				ELSE 'Zaa'
			END
			AND
				e.row BETWEEN @offSet AND (@offSet + @pageSize) --Pagination Logic
	END
</pre>
<p>As you can see in above example, i have used &#8220;over&#8221; clause to generate the row Number. <a title="SQL Server over clause" href="http://msdn.microsoft.com/en-us/library/ms189461.aspx" rel="nofollow">You can read more on over clause from here</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/sql/pagination-and-switch-case-in-where-clause-sql-server/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2861</post-id>	</item>
		<item>
		<title>Step By Step Hibernate Tutorial Using eclipse WTP</title>
		<link>https://www.jitendrazaa.com/blog/java/hibernate/step-by-step-hibernate-tutorial-using-eclipse-wtp/</link>
					<comments>https://www.jitendrazaa.com/blog/java/hibernate/step-by-step-hibernate-tutorial-using-eclipse-wtp/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Mon, 08 Aug 2011 07:33:43 +0000</pubDate>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[My SQL]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[JAVA]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=2347</guid>

					<description><![CDATA[Step By Step Hibernate (ORM Tool) Tutorial Using eclipse WTP]]></description>
										<content:encoded><![CDATA[<p>Hibernate is the ORM tool widely used in java community to persist the java object using Object Relational Mapping (ORM) concept. ORM reduces number of lines to interact with database with optimized query language which is <strong>Hibernate Query language (HQL)</strong>.</p>
<p>In this example, we will create a simple login application using hibernate tool of eclipse. We will use <strong>eclipse WTP</strong> (Web Tools Platform), to install &#8220;Hibernate Tools&#8221;. Follow below steps :</p>
<p>In Eclipse IDE, menu bar, select <strong>&#8220;Help&#8221; &gt;&gt; &#8220;Install New Software &#8230;&#8221;</strong> put the Eclipse update site URL <em>&#8220;http://download.jboss.org/jbosstools/updates/stable/helios&#8221;</em></p>
<figure id="attachment_2348" aria-describedby="caption-attachment-2348" style="width: 437px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Eclipse-Install-New-Software-Hibernate.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2348 " title="Eclipse Install New Software - Hibernate" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Eclipse-Install-New-Software-Hibernate.jpg?resize=437%2C186&#038;ssl=1" alt="Eclipse Install New Software - Hibernate" width="437" height="186" /></a><figcaption id="caption-attachment-2348" class="wp-caption-text">Eclipse Install New Software - Hibernate</figcaption></figure>
<p><span id="more-2347"></span></p>
<p>Select the tool and click on &#8220;Next&#8221;. Do not select all the tools; it will install all the unnecessary tools. We just need hibernate tools.</p>
<p>After installation, restart the eclipse.</p>
<p>If you don&#8217;t have the internet connection and want the offline method to add hibernate tools in eclipse. To install the Hibernate Tools, extract the <code>HibernateTools-3.X.zip</code> file and move all the files inside the features folder into the features folder of the eclipse installation directory and move all the files inside the plugins folder into the plugins folder of the ecilpse installation directory.</p>
<p>After restart, Go to <strong>Window | Open Perspective | Other</strong>, the following dialog box appears, select Hibernate and click the Ok button.</p>
<figure id="attachment_2349" aria-describedby="caption-attachment-2349" style="width: 347px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Eclipse-Hibernate-Perspective.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2349" title="Eclipse Hibernate Perspective" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Eclipse-Hibernate-Perspective.jpg?resize=347%2C422&#038;ssl=1" alt="Eclipse Hibernate Perspective" width="347" height="422" /></a><figcaption id="caption-attachment-2349" class="wp-caption-text">Eclipse Hibernate Perspective</figcaption></figure>
<p>Now let&#8217;s see how to define the object/relational mapping using the XML document. This document has <strong>.hbm.xml</strong> extension. We will now create the mapping between table and object of entity &#8220;user&#8221; which hold the data from database. So create the package <code>"in.shivasoft.pojo"</code> in src folder.<br />
Right click on project folder and select &#8220;<span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">Hibernate XML Mapping file (hbm.xml)</span><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">&#8220;.</span></p>
<figure id="attachment_2351" aria-describedby="caption-attachment-2351" style="width: 436px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-XML-Mapping-file-Menu-in-Hibernate-Tools-of-Eclipse.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2351 " title="Hibernate XML Mapping file Menu in Hibernate Tools of Eclipse" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-XML-Mapping-file-Menu-in-Hibernate-Tools-of-Eclipse.png?resize=436%2C106&#038;ssl=1" alt="Hibernate XML Mapping file Menu in Hibernate Tools of Eclipse" width="436" height="106" /></a><figcaption id="caption-attachment-2351" class="wp-caption-text">Hibernate XML Mapping file Menu in Hibernate Tools of Eclipse</figcaption></figure>
<p>Then one popup will appear, click on &#8220;Next&#8221;.</p>
<figure id="attachment_2352" aria-describedby="caption-attachment-2352" style="width: 421px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Create-Hibernate-XML-Mapping-files.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2352 " title="Create Hibernate XML Mapping file(s)" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Create-Hibernate-XML-Mapping-files.png?resize=421%2C453&#038;ssl=1" alt="Create Hibernate XML Mapping file(s)" width="421" height="453" /></a><figcaption id="caption-attachment-2352" class="wp-caption-text">Create Hibernate XML Mapping file(s)</figcaption></figure>
<p>Select the pojo folder and give name &#8220;Users.hbm.xml&#8221; and click on finish.</p>
<figure id="attachment_2353" aria-describedby="caption-attachment-2353" style="width: 423px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/New-Hibernate-XML-Mapping-files-hbm.xml_.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2353 " title="New Hibernate XML Mapping files (hbm.xml)" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/New-Hibernate-XML-Mapping-files-hbm.xml_.png?resize=423%2C450&#038;ssl=1" alt="New Hibernate XML Mapping files (hbm.xml)" width="423" height="450" /></a><figcaption id="caption-attachment-2353" class="wp-caption-text">New Hibernate XML Mapping files (hbm.xml)</figcaption></figure>
<p>Now, either you can configure the settings from the UI like below snap:</p>
<figure id="attachment_2355" aria-describedby="caption-attachment-2355" style="width: 436px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-3.0-XML-Editor.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2355 " title="Hibernate 3.0 XML Editor" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-3.0-XML-Editor.png?resize=436%2C174&#038;ssl=1" alt="Hibernate 3.0 XML Editor" width="436" height="174" /></a><figcaption id="caption-attachment-2355" class="wp-caption-text">Hibernate 3.0 XML Editor</figcaption></figure>
<p>Or, write below code :</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE hibernate-mapping PUBLIC &quot;-//Hibernate/Hibernate Mapping DTD 3.0//EN&quot; &quot;http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd&quot;&gt;
&lt;hibernate-mapping&gt;
 &lt;class entity-name=&quot;Users&quot; name=&quot;in.shivasoft.pojo.Users&quot; table=&quot;Users&quot;&gt;
  &lt;meta attribute=&quot;description&quot;&gt;This class is used to save the info about users&lt;/meta&gt;
  &lt;id column=&quot;UserId&quot; name=&quot;UserId&quot; type=&quot;long&quot;/&gt;
  &lt;property column=&quot;FName&quot; name=&quot;FName&quot; type=&quot;string&quot;/&gt;
  &lt;property column=&quot;LName&quot;  name=&quot;LName&quot; type=&quot;string&quot;/&gt;
  &lt;property column=&quot;UserTypeId&quot; name=&quot;UserTypeId&quot; type=&quot;long&quot;/&gt;
  &lt;property column=&quot;UserName&quot; name=&quot;UserName&quot; type=&quot;string&quot;/&gt;
  &lt;property column=&quot;Email&quot; name=&quot;Email&quot; type=&quot;string&quot;/&gt;
  &lt;property column=&quot;Pwd&quot; name=&quot;Pwd&quot; type=&quot;string&quot;/&gt;
  &lt;property column=&quot;Note&quot; name=&quot;Note&quot; type=&quot;string&quot;/&gt;
  &lt;property column=&quot;IsActive&quot; name=&quot;IsActive&quot; type=&quot;boolean&quot;/&gt;
 &lt;/class&gt;
&lt;/hibernate-mapping&gt;
</pre>
<p>Now right click and select &#8220;hibernate configuration file&#8221;. One window will open, there select the &#8220;src&#8221; folder and click on next.</p>
<figure id="attachment_2357" aria-describedby="caption-attachment-2357" style="width: 435px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Configuration-File-cfg.xml_.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2357  " title="Hibernate Configuration File (cfg.xml)" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Configuration-File-cfg.xml_.png?resize=435%2C382&#038;ssl=1" alt="Hibernate Configuration File (cfg.xml)" width="435" height="382" /></a><figcaption id="caption-attachment-2357" class="wp-caption-text">Hibernate Configuration File (cfg.xml)</figcaption></figure>
<p>Enter detail like below screen and click on finish button.</p>
<figure id="attachment_2359" aria-describedby="caption-attachment-2359" style="width: 437px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Configuration-File-cfg.xml-Wizard.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2359 " title="Hibernate Configuration File (cfg.xml) Wizard" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Configuration-File-cfg.xml-Wizard.png?resize=437%2C382&#038;ssl=1" alt="Hibernate Configuration File (cfg.xml) Wizard" width="437" height="382" /></a><figcaption id="caption-attachment-2359" class="wp-caption-text">Hibernate Configuration File (cfg.xml) Wizard</figcaption></figure>
<p>After this add the Users.hbm.xml file to the newly generated xml configuration.</p>
<pre class="brush: xml; highlight: [12]; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE hibernate-configuration PUBLIC
		&quot;-//Hibernate/Hibernate Configuration DTD 3.0//EN&quot;
		&quot;http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd&quot;&gt;
&lt;hibernate-configuration&gt;
    &lt;session-factory&gt;
        &lt;property name=&quot;hibernate.connection.driver_class&quot;&gt; org.gjt.mm.mysql.Driver &lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.password&quot;&gt; root &lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.url&quot;&gt; jdbc:mysql://localhost/test &lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.username&quot;&gt; root &lt;/property&gt;
        &lt;property name=&quot;hibernate.dialect&quot;&gt; org.hibernate.dialect.MySQL5InnoDBDialect &lt;/property&gt;
        &lt;mapping resource=&quot;in/shivasoft/pojo/Users.hbm.xml&quot;/&gt;
    &lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;
</pre>
<p>After the entire configuration, in the toolbar you can select &#8220;hibernate code generation tool&#8221;.</p>
<figure id="attachment_2361" aria-describedby="caption-attachment-2361" style="width: 325px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Code-Generation-Configurations.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2361" title="Hibernate Code Generation Configurations" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Code-Generation-Configurations.png?resize=325%2C132&#038;ssl=1" alt="Hibernate Code Generation Configurations" width="325" height="132" /></a><figcaption id="caption-attachment-2361" class="wp-caption-text">Hibernate Code Generation Configurations</figcaption></figure>
<figure id="attachment_2362" aria-describedby="caption-attachment-2362" style="width: 436px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Code-Generation-Wizard-in-Eclipse.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2362 " title="Hibernate Code Generation Wizard in Eclipse" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Code-Generation-Wizard-in-Eclipse.png?resize=436%2C216&#038;ssl=1" alt="Hibernate Code Generation Wizard in Eclipse" width="436" height="216" /></a><figcaption id="caption-attachment-2362" class="wp-caption-text">Hibernate Code Generation Wizard in Eclipse</figcaption></figure>
<p>Now select the Exporters tab and select &#8220;Use Java 5 Syntax&#8221;.</p>
<figure id="attachment_2363" aria-describedby="caption-attachment-2363" style="width: 418px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Code-Generation-Wizard-in-Eclipse-Exporters-Tab.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2363 " title="Hibernate Code Generation Wizard in Eclipse-Exporters Tab" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Code-Generation-Wizard-in-Eclipse-Exporters-Tab.png?resize=418%2C269&#038;ssl=1" alt="Hibernate Code Generation Wizard in Eclipse-Exporters Tab" width="418" height="269" /></a><figcaption id="caption-attachment-2363" class="wp-caption-text">Hibernate Code Generation Wizard in Eclipse-Exporters Tab</figcaption></figure>
<p>In refresh tab, select &#8220;<span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">The Project containing the selected resource</span>&#8220;.</p>
<figure id="attachment_2364" aria-describedby="caption-attachment-2364" style="width: 436px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Code-Generation-Wizard-in-Eclipse-Refresh-Tab.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2364 " title="Hibernate Code Generation Wizard in Eclipse- Refresh Tab" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/08/Hibernate-Code-Generation-Wizard-in-Eclipse-Refresh-Tab.png?resize=436%2C239&#038;ssl=1" alt="Hibernate Code Generation Wizard in Eclipse- Refresh Tab" width="436" height="239" /></a><figcaption id="caption-attachment-2364" class="wp-caption-text">Hibernate Code Generation Wizard in Eclipse- Refresh Tab</figcaption></figure>
<p>Now click the run button to finish java code generation. Following code will be generated:</p>
<pre class="brush: java; title: ; notranslate">
package in.shivasoft.pojo;

// Generated Aug 1, 2011 7:02:59 PM by Hibernate Tools 3.4.0.CR1

/**
 * Users generated by hbm2java
 */
public class Users implements java.io.Serializable {

	private long UserId;
	private String FName;
	private String LName;
	private long UserTypeId;
	private String UserName;
	private String Email;
	private String Pwd;
	private String Note;
	private boolean IsActive;

	public Users() {
	}

	public Users(long UserId) {
		this.UserId = UserId;
	}

	public Users(long UserId, String FName, String LName, long UserTypeId,
			String UserName, String Email, String Pwd, String Note,
			boolean IsActive) {
		this.UserId = UserId;
		this.FName = FName;
		this.LName = LName;
		this.UserTypeId = UserTypeId;
		this.UserName = UserName;
		this.Email = Email;
		this.Pwd = Pwd;
		this.Note = Note;
		this.IsActive = IsActive;
	}

	public long getUserId() {
		return this.UserId;
	}

	public void setUserId(long UserId) {
		this.UserId = UserId;
	}

	public String getFName() {
		return this.FName;
	}

	public void setFName(String FName) {
		this.FName = FName;
	}

	public String getLName() {
		return this.LName;
	}

	public void setLName(String LName) {
		this.LName = LName;
	}

	public long getUserTypeId() {
		return this.UserTypeId;
	}

	public void setUserTypeId(long UserTypeId) {
		this.UserTypeId = UserTypeId;
	}

	public String getUserName() {
		return this.UserName;
	}

	public void setUserName(String UserName) {
		this.UserName = UserName;
	}

	public String getEmail() {
		return this.Email;
	}

	public void setEmail(String Email) {
		this.Email = Email;
	}

	public String getPwd() {
		return this.Pwd;
	}

	public void setPwd(String Pwd) {
		this.Pwd = Pwd;
	}

	public String getNote() {
		return this.Note;
	}

	public void setNote(String Note) {
		this.Note = Note;
	}

	public boolean isIsActive() {
		return this.IsActive;
	}

	public void setIsActive(boolean IsActive) {
		this.IsActive = IsActive;
	}

}
</pre>
<p>Now create the</p>
<pre>HibernateUtil</pre>
<p>class. The HibernateUtil class helps in creating the <span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">SessionFactory </span>from the Hibernate configuration file. The SessionFactory is threadsafe, so it is not necessary to obtain one for each thread. Here the static singleton pattern is used to instantiate the SessionFactory. The implementation of the HibernateUtil class is shown below.</p>
<pre class="brush: java; title: ; notranslate">
package in.shivasoft.util;

import org.hibernate.SessionFactory;

import org.hibernate.cfg.Configuration;

public class HibernateUtil {

	private static final SessionFactory sessionFactory;

	static {

		try {

			sessionFactory = new Configuration().configure()
			.buildSessionFactory();

		} catch (Throwable ex) {

			System.err.println(&quot;Initial SessionFactory creation failed.&quot; + ex);

			throw new ExceptionInInitializerError(ex);

		}

	}

	public static SessionFactory getSessionFactory() {

		return sessionFactory;

	}
}
</pre>
<p>Now, create the test application having main method which will demonstrate that how data is saved:</p>
<pre class="brush: java; title: ; notranslate">
package in.shivasoft.test;

import in.shivasoft.pojo.Users;
import in.shivasoft.util.HibernateUtil;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

public class TestMain {

	/**
	 * @param args
	 */
	public static void main(String&#x5B;] args) {
		TestMain obj = new TestMain();
		//obj.saveRecord();
		obj.updateUser(12);
		obj.deleteUser(13);
		obj.getList();
	}

	public void saveRecord()
	{
		Users u = new Users(0, &quot;Jitendra&quot;, &quot;Zaa&quot;, 1, &quot;jitendra.zaa&quot;, &quot;jitendra.zaa@JitendraZaa.com&quot;, &quot;test&quot;, &quot;this is note&quot;, true);
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = null;
		try
		{
			transaction = session.beginTransaction();
			session.save(u);
			transaction.commit();
			System.out.println(&quot;Data Saved&quot;);
		}catch(Exception e)
		{
			e.printStackTrace();
		}finally{session.close();}

	}
	public void deleteUser(long UserId)
	{
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = null;
		try
		{
			transaction = session.beginTransaction();
			Users u = (Users)session.get(Users.class,UserId);
			session.delete(u);
			transaction.commit();
			System.out.println(&quot;Data Deleted&quot;);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		finally{
			session.close();
		}
	}
	public void updateUser(long UserId)
	{
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = null;
		try
		{
			transaction = session.beginTransaction();
			Users u = (Users)session.get(Users.class,UserId);
			u.setFName(&quot;ShivaSoft&quot;);
			transaction.commit();
			System.out.println(&quot;Data Updated&quot;);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		finally{
			session.close();
		}
	}

	public void getList()
	{
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = null;
		try
		{
			transaction = session.beginTransaction();
			List&lt;Users&gt; uList = session.createQuery(&quot;from Users&quot;).list();
			for(Users u : uList)
			{
				System.out.println(&quot;First Name - &quot;+u.getFName());
			}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		finally{
			session.close();
		}
	}
}
</pre>
<p>Needed jar files :</p>
<blockquote><p>antlr-2.7.6.jar<br />
commons-collections-3.1.jar<br />
dom4j-1.6.1.jar<br />
hibernate-core.3.3.1.GA.jar<br />
javassist-3.9.0.GA.jar<br />
jta-1.1.jar<br />
mysql-connector-java-5.1.1.17-bin.jar<br />
slf4j-api-1.6.1.jar<br />
slf4j-api-1.6.1-tests.jar<br />
slf4j-slf4j-simple-2.0.jar</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/hibernate/step-by-step-hibernate-tutorial-using-eclipse-wtp/feed/</wfw:commentRss>
			<slash:comments>31</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2347</post-id>	</item>
		<item>
		<title>Create BPA Script in Oracle Utilities to invoke UI Map</title>
		<link>https://www.jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/</link>
					<comments>https://www.jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Wed, 15 Jun 2011 06:57:57 +0000</pubDate>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[CC&B /ORMB / SPL]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=2243</guid>

					<description><![CDATA[This is the fourth article in series And we will see how to Create BPA Script in Oracle Utilities to invoke UI Map.]]></description>
										<content:encoded><![CDATA[<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; margin-top: 10px; color: #140b5c;">
<ol>
<li> <a style="color: #140b5c !important;" title="Creating Data Area in Oracle Utilities" href="https://jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/" target="_blank">Part 1 &#8211; Creating Data Area in Oracle Utilities </a></li>
<li> <a style="color: #140b5c !important;" title="Creating Business Service and Service Program in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/" target="_blank">Part 2 &#8211; Creating Business Service and Service Program </a></li>
<li> <a style="color: #140b5c !important;" title="Creating UI Map in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/" target="_blank"> Part 3 &#8211; UI Map in Oracle Utilities</a></li>
<li> <a style="color: #140b5c !important;" title="BPA Script in Oracle Utilities to invoke UI Map" href="https://jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/" target="_blank"> Part 4 &#8211; BPA Script in Oracle Utilities to invoke UI Map</a></li>
</ol>
</div>
<p>In this post, i will discuss on creating the BPA Script to invoke the UI Map.</p>
<p>Navigate to &#8220;<strong>Admin Menu | S | Script +</strong>&#8221; and the details as per below image:</p>
<p style="text-align: center;">&nbsp;</p>
<figure id="attachment_2245" aria-describedby="caption-attachment-2245" style="width: 471px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Creating-BPA-Script-in-Oracle-Utilities.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2245 " title="Creating BPA Script in Oracle Utilities / ORMB / CC&amp;B" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Creating-BPA-Script-in-Oracle-Utilities.png?resize=471%2C216&#038;ssl=1" alt="Creating BPA Script in Oracle Utilities / ORMB / CC&amp;B" width="471" height="216" /></a><figcaption id="caption-attachment-2245" class="wp-caption-text">Creating BPA Script in Oracle Utilities</figcaption></figure>
<p><span id="more-2243"></span>Go to &#8220;Data Area&#8221; tab and add entries like below snap:</p>
<figure id="attachment_2247" aria-describedby="caption-attachment-2247" style="width: 402px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Add-Data-Area-for-BPA-Script-in-Oracle-Utilities.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2247  " title="Add Data Area for BPA Script in Oracle Utilities / CC&amp;B / ORMB" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Add-Data-Area-for-BPA-Script-in-Oracle-Utilities.png?resize=402%2C111&#038;ssl=1" alt="Add Data Area for BPA Script in Oracle Utilities / CC&amp;B / ORMB" width="402" height="111" /></a><figcaption id="caption-attachment-2247" class="wp-caption-text">Add Data Area for BPA Script in Oracle Utilities</figcaption></figure>
<p>In this section, we have to add the references of all the &#8220;UI Map, Business Service and Data Area&#8221; which we have used in this application.<br />
Now, go to Step tab and add below line in &#8220;Edit Text area&#8221; where the step Type is&#8221;Edit Data&#8221;.</p>
<blockquote><p>invokeMap &#8216;CM_PERINPUT&#8217; using &#8220;PersonDataA&#8221; target page;</p></blockquote>
<p><strong>Description:</strong> invokeMap command is used to invoke the UI Map using Data Area Name. &#8220;target page&#8221; argument specifies that the Map should be open as a new page.</p>
<figure id="attachment_2248" aria-describedby="caption-attachment-2248" style="width: 440px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Edit-Data-Step-in-BPA-Script-of-Oracle-Utilities.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2248 " title="Edit Data Step in BPA Script of Oracle Utilities / ORMB / CC&amp;B" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Edit-Data-Step-in-BPA-Script-of-Oracle-Utilities.png?resize=440%2C181&#038;ssl=1" alt="Edit Data Step in BPA Script of Oracle Utilities / ORMB / CC&amp;B" width="440" height="181" /></a><figcaption id="caption-attachment-2248" class="wp-caption-text">Edit Data Step in BPA Script of Oracle Utilities</figcaption></figure>
<p>Now, to run the BPA Script press &#8220;Ctrl + Shift + S&#8221; or click on BPA Script icon as shown in below image:</p>
<figure id="attachment_2249" aria-describedby="caption-attachment-2249" style="width: 440px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Run-BPA-Script-from-Toolbar-in-Oracle-Utilities.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2249 " title="Run BPA Script from Toolbar in Oracle Utilities / ORMB / CC&amp;B" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Run-BPA-Script-from-Toolbar-in-Oracle-Utilities.png?resize=440%2C62&#038;ssl=1" alt="Run BPA Script from Toolbar in Oracle Utilities / ORMB / CC&amp;B" width="440" height="62" /></a><figcaption id="caption-attachment-2249" class="wp-caption-text">Run BPA Script from Toolbar in Oracle Utilities</figcaption></figure>
<p>Below pop up window will open, where you can search your BPA script and run it.</p>
<figure id="attachment_2250" aria-describedby="caption-attachment-2250" style="width: 402px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/popup-window-to-run-the-BPA-Script.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2250" title="popup window to run the BPA Script / ORMB / CC&amp;B" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/popup-window-to-run-the-BPA-Script.png?resize=402%2C413&#038;ssl=1" alt="popup window to run the BPA Script / ORMB / CC&amp;B" width="402" height="413" /></a><figcaption id="caption-attachment-2250" class="wp-caption-text">popup window to run the BPA Script</figcaption></figure>
<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; margin-top: 10px; color: #140b5c;">
<ol>
<li> <a style="color: #140b5c !important;" title="Creating Data Area in Oracle Utilities" href="https://jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/" target="_blank">Part 1 &#8211; Creating Data Area in Oracle Utilities </a></li>
<li> <a style="color: #140b5c !important;" title="Creating Business Service and Service Program in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/" target="_blank">Part 2 &#8211; Creating Business Service and Service Program </a></li>
<li> <a style="color: #140b5c !important;" title="Creating UI Map in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/" target="_blank"> Part 3 &#8211; UI Map in Oracle Utilities</a></li>
<li> <a style="color: #140b5c !important;" title="BPA Script in Oracle Utilities to invoke UI Map" href="https://jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/" target="_blank"> Part 4 &#8211; BPA Script in Oracle Utilities to invoke UI Map</a></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2243</post-id>	</item>
		<item>
		<title>Creating UI Map in Oracle Utilities</title>
		<link>https://www.jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/</link>
					<comments>https://www.jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/#respond</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Wed, 15 Jun 2011 06:36:41 +0000</pubDate>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[CC&B /ORMB / SPL]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=2232</guid>

					<description><![CDATA[This is the third article in series for creating the UI Map in Oracle Utlities / CC&#038;B / ORMB]]></description>
										<content:encoded><![CDATA[<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; margin-top: 10px; color: #140b5c;">
<ol>
<li> <a style="color: #140b5c !important;" title="Creating Data Area in Oracle Utilities" href="https://jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/" target="_blank">Part 1 &#8211; Creating Data Area in Oracle Utilities </a></li>
<li> <a style="color: #140b5c !important;" title="Creating Business Service and Service Program in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/" target="_blank">Part 2 &#8211; Creating Business Service and Service Program </a></li>
<li> <a style="color: #140b5c !important;" title="Creating UI Map in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/" target="_blank"> Part 3 &#8211; UI Map in Oracle Utilities</a></li>
<li> <a style="color: #140b5c !important;" title="BPA Script in Oracle Utilities to invoke UI Map" href="https://jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/" target="_blank"> Part 4 &#8211; BPA Script in Oracle Utilities to invoke UI Map</a></li>
</ol>
</div>
<p>This is the third article in series to create the UI Map in Oracle Utilities. In Previous two article we have seen that how to create the Business Service, Data Area and Service Program.</p>
<p>Navigate to &#8220;<strong>Admin Menu | U | UI Map +</strong>&#8220;. Give the UI Map Name as &#8220;<em><span style="text-decoration: underline;">CM_PERINPUT</span></em>&#8221; and select &#8220;UI Map Type&#8221; = Complete HTML Document.</p>
<figure id="attachment_2234" aria-describedby="caption-attachment-2234" style="width: 440px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Creating-UI-Map-in-Oracle-Utilities.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2234 " title="Creating UI Map in Oracle Utilities / CC&amp;B / ORMB" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Creating-UI-Map-in-Oracle-Utilities.png?resize=440%2C170&#038;ssl=1" alt="Creating UI Map in Oracle Utilities / CC&amp;B / ORMB" width="440" height="170" /></a><figcaption id="caption-attachment-2234" class="wp-caption-text">Creating UI Map in Oracle Utilities</figcaption></figure>
<p><span id="more-2232"></span>Now go to Schema Tab and in bottom section add below schema:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;schema&gt;
    &lt;pNameSearch type=&quot;group&quot;&gt;
        &lt;includeBS name=&quot;CM_PERSER&quot;/&gt;
    &lt;/pNameSearch&gt;
&lt;/schema&gt;
</pre>
<p>In above schema, we have included the Business Service &#8220;<span style="text-decoration: underline;"><em>CM_PERSER</em></span>&#8221; by using tag &lt;includeBS&gt;.<br />
In this way our UI Map will get the Schema of our &#8220;Business Service&#8221; which has all the definition about which should go to header part and which should go to body part.<br />
Now to generate the HTML you can use &#8220;Generate HTML&#8221; feature which have options to generate &#8220;Display only UI&#8221; or &#8220;Input UI&#8221; as per shown in below image.</p>
<figure id="attachment_2238" aria-describedby="caption-attachment-2238" style="width: 253px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Generate-HTML-in-UI-Map-in-Oracle-Utilities.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2238" title="Generate HTML in UI Map in Oracle Utilities / ORMB / CC&amp;B" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Generate-HTML-in-UI-Map-in-Oracle-Utilities.png?resize=253%2C344&#038;ssl=1" alt="Generate HTML in UI Map in Oracle Utilities / ORMB / CC&amp;B" width="253" height="344" /></a><figcaption id="caption-attachment-2238" class="wp-caption-text">Generate HTML in UI Map in Oracle Utilities</figcaption></figure>
<p><!--more-->I used the &#8220;Input Map&#8221; and then customized. Following is the complete code.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
    &lt;head&gt;
        &lt;META http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
        &lt;title&gt;&lt;/title&gt;
        &lt;link href=&quot;cisDisabled.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot;&gt;
        &lt;link href=&quot;cisEnabled.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot;&gt;
      &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;

   function validateEnterKey(e, htmlElement){
                var characterCode;
                if(e &amp;&amp; e.which){ //if which property of event object is supported (NN4)
                    e = e;
                    characterCode = e.which; //character code is contained in NN4's which property
                }
                else{
                    e = event
                    characterCode = e.keyCode; //character code is contained in IE's keyCode property
                }

                if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
                    return true; //Detected enter key press event
                }
                else{
                    return false;
                }
            }

    function searchByPName()
    {
         oraInvokeBS('CM_PERSER','pNameSearch' );
         showResults();
    }

      function showResults(){
                document.getElementById('resultTable') .style.display=&quot;inline&quot;;
            }

    &lt;/script&gt;
    &lt;/head&gt;
    &lt;body oraError=&quot;automate:true; prefix:boGroup&quot;&gt;
        &lt;table cellpadding=&quot;12&quot; width=&quot;100%&quot;&gt;
            &lt;tr class=&quot;oraErrorText&quot;&gt;
                &lt;td&gt;&lt;a onclick=&quot;oraShowErrorAlert(); return false;&quot; href=&quot;&quot;&gt;&lt;span oraErrorVar=&quot;ERRMSG-TEXT&quot; class=&quot;oraErrorText&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
        &lt;table cellspacing=&quot;4&quot; width=&quot;100%&quot;&gt;
            &lt;colgroup&gt;
                &lt;col class=&quot;oraLabel oraTableLabel&quot;&gt;
                &lt;col class=&quot;oraNormal oraTableData&quot;&gt;
            &lt;/colgroup&gt;
            &lt;tr&gt;
                &lt;td&gt;Search Person &lt;/td&gt;
             &lt;td&gt;&lt;input class=&quot;oraInput&quot; oraField=&quot;pNameSearch/pageHeader/personName&quot; id=&quot;serPer&quot; onKeyDown=&quot;if(validateEnterKey(event,this)){searchByPName();};&quot;&gt;
                    &lt;img src=&quot;images/runSearch.gif&quot; onclick=&quot;searchByPName()&quot;/&gt;
        &lt;/td&gt;
            &lt;/tr&gt;

                 &lt;tr&gt;
                &lt;td class=&quot;oraEmbeddedTable oraSectionEnd&quot; colspan=&quot;2&quot;&gt;
                    &lt;div class=&quot;oraGridDiv&quot;&gt;
                        &lt;table cellspacing=&quot;2&quot; style=&quot;display:none&quot; oraList=&quot;pNameSearch/pageBody/PerNameList&quot; id=&quot;resultTable&quot; onResize=&quot;if (this.clientWidth &gt; this.parentNode.clientWidth) { this.parentNode.className += ' oraGridDivScroll';};&quot;&gt;
                            &lt;thead&gt;
                                &lt;tr&gt;
                                    &lt;th nowrap oraLabel=&quot;entityName&quot; class=&quot;oraGridColumnHeader&quot;&gt;&lt;/th&gt;
                                &lt;/tr&gt;
                            &lt;/thead&gt;
                            &lt;tbody&gt;
                                &lt;tr&gt;
                                    &lt;td oraField=&quot;entityName&quot; class=&quot;oraNormal oraDisplayCell&quot;&gt;&lt;/td&gt;
                                &lt;/tr&gt;
                            &lt;/tbody&gt;
                        &lt;/table&gt;
                    &lt;/div&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/body&gt;
    &lt;xml style=&quot;display:none;&quot;&gt;&lt;/xml&gt;
&lt;/html&gt;
</pre>
<p>Now, look into the below java script function which I have added In above code:</p>
<pre class="brush: csharp; title: ; notranslate">
function searchByPName()
    {
         oraInvokeBS('CM_PERSER','pNameSearch' );
         showResults();
    }
</pre>
<p><strong>oraInvokeBS </strong>is the Utility java script method provided by the CC&amp;B / ORMB which invokes the Business Service. First Parameter is the &#8220;Business Service Name&#8221; and second parameter is the xpath value from where the output of Business service (Java Program) should be copied.<br />
Click on save button to save the UI Map.<br />
To check the UI and working of UI Map, go to Main tab and click on &#8220;Test UI Map&#8221;.</p>
<p>Following output will be shown:</p>
<p style="text-align: center;">&nbsp;</p>
<figure id="attachment_2239" aria-describedby="caption-attachment-2239" style="width: 439px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Test-UI-Map-in-Oracle-Utilities.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2239 " title="Test UI Map in Oracle Utilities / CC&amp;B / ORMB" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Test-UI-Map-in-Oracle-Utilities.png?resize=439%2C186&#038;ssl=1" alt="Test UI Map in Oracle Utilities / CC&amp;B / ORMB" width="439" height="186" /></a><figcaption id="caption-attachment-2239" class="wp-caption-text">Test UI Map in Oracle Utilities</figcaption></figure>
<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; margin-top: 10px; color: #140b5c;">
<ol>
<li> <a style="color: #140b5c !important;" title="Creating Data Area in Oracle Utilities" href="https://jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/" target="_blank">Part 1 &#8211; Creating Data Area in Oracle Utilities </a></li>
<li> <a style="color: #140b5c !important;" title="Creating Business Service and Service Program in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/" target="_blank">Part 2 &#8211; Creating Business Service and Service Program </a></li>
<li> <a style="color: #140b5c !important;" title="Creating UI Map in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/" target="_blank"> Part 3 &#8211; UI Map in Oracle Utilities</a></li>
<li> <a style="color: #140b5c !important;" title="BPA Script in Oracle Utilities to invoke UI Map" href="https://jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/" target="_blank"> Part 4 &#8211; BPA Script in Oracle Utilities to invoke UI Map</a></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2232</post-id>	</item>
		<item>
		<title>Creating Business Service and Service Program in ORMB / CC&#038;B / Oracle Utilities</title>
		<link>https://www.jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/</link>
					<comments>https://www.jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Wed, 15 Jun 2011 05:47:04 +0000</pubDate>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[CC&B /ORMB / SPL]]></category>
		<category><![CDATA[Eclipse]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=2207</guid>

					<description><![CDATA[Creating Business Service and Service Programin ORMB / CC&#038;B / Oracle Utilities]]></description>
										<content:encoded><![CDATA[<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; margin-top: 10px; color: #140b5c;">
<ol>
<li> <a style="color: #140b5c !important;" title="Creating Data Area in Oracle Utilities" href="https://jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/" target="_blank">Part 1 &#8211; Creating Data Area in Oracle Utilities </a></li>
<li> <a style="color: #140b5c !important;" title="Creating Business Service and Service Program in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/" target="_blank">Part 2 &#8211; Creating Business Service and Service Program </a></li>
<li> <a style="color: #140b5c !important;" title="Creating UI Map in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/" target="_blank"> Part 3 &#8211; UI Map in Oracle Utilities</a></li>
<li> <a style="color: #140b5c !important;" title="BPA Script in Oracle Utilities to invoke UI Map" href="https://jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/" target="_blank"> Part 4 &#8211; BPA Script in Oracle Utilities to invoke UI Map</a></li>
</ol>
</div>
<p>In Previous article, we have seen that how to create the Data Area and benefits of using Data Area. This article will focus on creating the Business Service and Service Program in CC&amp;B.</p>
<p>First we have to create the Business Service in application then we have to code it in JAVA and deploy the updated &#8220;<strong>cm.jar</strong>&#8220; file on server.</p>
<p>Go to &#8220;<strong>Admin | S | Service Program +</strong>&#8220; and enter the Service name, Description and select the &#8220;Java Based Service&#8221; as Service Type.  In this example my service name is &#8220;<em><span style="text-decoration: underline;">PERSER</span></em>&#8220;.</p>
<p>Now go to &#8220;<strong>Admin | B | Business Service +</strong>&#8220; and enter the Business Service name and select the previously create service &#8220;<em><span style="text-decoration: underline;">PERSER</span></em>&#8220; for Service Name using look up. In this case the Business Service Name is &#8220;<em><span style="text-decoration: underline;">CM_PERSER</span></em>&#8220;.<br />
Now go to the &#8220;Schema&#8221; and add following code and click on Save.<span id="more-2207"></span></p>
<pre class="brush: xml; title: ; notranslate">
&lt;schema&gt;
    &lt;includeDA name=&quot;PersonDataA&quot;/&gt;
&lt;/schema&gt;
</pre>
<p>You can see one benefit of having &#8220;Data Area&#8221;. Instead of declaring schema we have used existing data area which we have created earlier.<br />
We are now ready to create the Business Service for &#8220;<em><span style="text-decoration: underline;">PERSER</span></em>&#8220; Service Program using Java Code.</p>
<p>Open Eclipse and go to &#8220;<strong>File | New | Page Service</strong>&#8220;.</p>
<p>Select Page type as &#8220;<strong>Query</strong>&#8220; and click on Next.</p>
<p>Enter the Program name and Service name as &#8220;<em><span style="text-decoration: underline;">PERSER</span></em>&#8220;, which we have created earlier. In Module, Click on &#8220;Add&#8221;  and Select &#8220;DM&#8221; (This is demo module, I normally uses this Module).</p>
<p>It&#8217;s time to add the header. As we have already discussed that i want to get the Person name from user. And in DataArea, we have added ENTITY-NAME in header. So in same way, we have to add ENTITY-NAME here also.</p>
<p>So go to &#8220;<strong>Edit array of Header Fields</strong>&#8220; and on &#8220;+&#8221; button Search for the &#8220;ENTITY_NAME&#8221; and click on OK. Come back to main service windows and click on &#8220;<strong>Edit array of Lists</strong>&#8220;.  We want the list of person name which will be the part of body. To include the List in body first we have to declare the List and then add it in the body.<br />
When we click on &#8220;<strong>Edit array of Lists</strong>&#8220;, one pop up window will appear on that click on &#8220;+&#8221;.</p>
<figure id="attachment_2210" aria-describedby="caption-attachment-2210" style="width: 437px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Edit-Array-Eclipse-ORMB.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2210" title="Edit Array Eclipse ORMB / CC&amp;B / Oracle Utilities" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Edit-Array-Eclipse-ORMB.png?resize=437%2C350&#038;ssl=1" alt="Edit Array Eclipse ORMB / CC&amp;B / Oracle Utilities" width="437" height="350" /></a><figcaption id="caption-attachment-2210" class="wp-caption-text">Edit Array Eclipse ORMB</figcaption></figure>
<p>After clicking on &#8220;+&#8221;, one new window will open.</p>
<figure id="attachment_2214" aria-describedby="caption-attachment-2214" style="width: 391px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Annotation-Editor-in-Eclipse-of-ORMB.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2214" title="Annotation Editor in Eclipse of ORMB / CC&amp;B / Oracle Utilities" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Annotation-Editor-in-Eclipse-of-ORMB.png?resize=391%2C547&#038;ssl=1" alt="Annotation Editor in Eclipse of ORMB / CC&amp;B / Oracle Utilities" width="391" height="547" /></a><figcaption id="caption-attachment-2214" class="wp-caption-text">Annotation Editor in Eclipse of ORMB</figcaption></figure>
<p>In that provide the Name and Size. In this example I have used name = &#8220;<em><span style="text-decoration: underline;">PerNameList</span></em>&#8220; and size = 100. Click on &#8220;<strong>Edit Data Element</strong>&#8220; button of body.<br />
One window will be opened. In that select &#8220;<strong>Edit Contents</strong>&#8220;.</p>
<figure id="attachment_2215" aria-describedby="caption-attachment-2215" style="width: 349px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Annotation-Editor-Edit-Content-in-Eclipse-of-ORMB.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2215" title="Annotation Editor - Edit Content in Eclipse of ORMB / CC&amp;B / Oracle Utilities" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Annotation-Editor-Edit-Content-in-Eclipse-of-ORMB.png?resize=349%2C325&#038;ssl=1" alt="Annotation Editor - Edit Content in Eclipse of ORMB / CC&amp;B / Oracle Utilities" width="349" height="325" /></a><figcaption id="caption-attachment-2215" class="wp-caption-text">Annotation Editor - Edit Content in Eclipse of ORMB</figcaption></figure>
<p>Again window will open in that click on &#8220;+&#8221; and select &#8220;Field&#8221;.</p>
<figure id="attachment_2217" aria-describedby="caption-attachment-2217" style="width: 465px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Add-Child-Annotation-in-Eclipse-for-ORMB.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2217" title="Add Child Annotation in Eclipse for ORMB / CC&amp;B / Oracle Utilities" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Add-Child-Annotation-in-Eclipse-for-ORMB.png?resize=465%2C371&#038;ssl=1" alt="Add Child Annotation in Eclipse for ORMB / CC&amp;B / Oracle Utilities" width="465" height="371" /></a><figcaption id="caption-attachment-2217" class="wp-caption-text">Add Child Annotation in Eclipse for ORMB</figcaption></figure>
<p>One new window will open, enter the &#8220;<span style="text-decoration: underline;"><em>ENTITY_NAME</em></span>&#8221; as &#8220;Name&#8221;, you can search the Name from search option. Click on Ok / Finish Button until you come to Parent Window shown below.</p>
<figure id="attachment_2219" aria-describedby="caption-attachment-2219" style="width: 335px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Page-Service-in-Eclipse-of-ORMB.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2219" title="Page Service in Eclipse of ORMB / CC&amp;B / Oracle Utilities" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Page-Service-in-Eclipse-of-ORMB.png?resize=335%2C472&#038;ssl=1" alt="Page Service in Eclipse of ORMB / CC&amp;B / Oracle Utilities" width="335" height="472" /></a><figcaption id="caption-attachment-2219" class="wp-caption-text">Page Service in Eclipse of ORMB</figcaption></figure>
<p>Click on Edit &#8220;<strong>DataElement</strong>&#8220; of the Body and click on &#8220;<strong>Edit Contents</strong>&#8220;, then click on&#8221;+&#8221; and List. In List, give the previously created list name which is &#8220;<span style="text-decoration: underline;"><em>PerNameList&#8221;</em></span> and owner is &#8220;cm&#8221;. And click on Ok / Finish.  Java file will be created, which have following code:</p>
<pre class="brush: java; title: ; notranslate">
/**
 * @author jitendra zaa
 *
@QueryPage (program = PERSER, service = PERSER,
 *      body = @DataElement (contents = { @ListField (name = PerNameList)
 *                  , @DataField (name = ENTITY_NAME)}),
 *      actions = { &quot;add&quot;
 *            , &quot;change&quot;
 *            , &quot;read&quot;
 *            , &quot;delete&quot;},
 *      header = { @DataField (name = ENTITY_NAME)},
 *      headerFields = { @DataField (name = ENTITY_NAME)},
 *      lists = { @List (name = PerNameList, size = 100,
 *                  body = @DataElement (contents = { @DataField (name = ENTITY_NAME)}))},
 *      modules = { &quot;demo&quot;})
 */
public class PerSer extends PerSer_Gen {

}

</pre>
<p>As you can see, the entire configuration is added as annotation in Java Program.</p>
<figure id="attachment_2221" aria-describedby="caption-attachment-2221" style="width: 223px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Artifcat-generator-in-Eclipse-for-CCB.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2221" title="Artifcat generator in Eclipse for CC&amp;B / ORMB / Oracle Utilities" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Artifcat-generator-in-Eclipse-for-CCB.png?resize=223%2C133&#038;ssl=1" alt="Artifcat generator in Eclipse for CC&amp;B / ORMB / Oracle Utilities" width="223" height="133" /></a><figcaption id="caption-attachment-2221" class="wp-caption-text">Artifcat generator in Eclipse for CC&amp;B</figcaption></figure>
<p>Click on &#8220;Generate Artifacts&#8221; to generate the<strong> supported classes for the &#8220;Business Service / Page Service&#8221;</strong>.<br />
After successful completion add following method in above Java File:</p>
<pre class="brush: java; title: ; notranslate">
protected DataElement read(PageHeader header) throws ApplicationError {
		System.out.println(&quot; ************ In PerSer Read Method ************ &quot;);
		DataElement ret = new DataElement();
		DataElement perData ;
		ItemList perList = new DataElement().newList(STRUCTURE.list_PerNameList.name);

		String entityName = &quot;&quot; ;
		if(header.get(&quot;ENTITY_NAME&quot;) != null)
		{
			entityName = header.get(&quot;ENTITY_NAME&quot;).toString();
		}
		System.out.println(&quot; *************** Header Value **************&quot;+entityName);
		/* If value is not coming through header */
		if(entityName.equals(&quot;&quot;)){
			entityName = &quot;A&quot;;
		}
		PreparedStatement stmt = createPreparedStatement(&quot;SELECT ENTITY_NAME FROM CI_PER_NAME WHERE ENTITY_NAME LIKE :entityName&quot;);
		stmt.bindString(&quot;entityName&quot;, entityName, &quot;ENTITY_NAME&quot;);
		System.out.println(&quot;******** SQL Statement : &quot;+ stmt.toString()+&quot; ************ &quot;);
		List resultSetList = stmt.list();

		if (resultSetList != null &amp;&amp; !resultSetList.isEmpty()) {
			for (SQLResultRow eResult : resultSetList) {
				perData = perList.newDataElement();
				if (eResult.getString(&quot;ENTITY_NAME&quot;) != null
						&amp;&amp; !eResult.getString(&quot;ENTITY_NAME&quot;).trim().equals(&quot;&quot;)) {
					perData.put(STRUCTURE.ENTITY_NAME, eResult.getString(&quot;ENTITY_NAME&quot;).toString().trim());
					System.out.println(&quot;****** Name : **********&quot;+eResult.getString(&quot;ENTITY_NAME&quot;));
				}
			}
		}
		ret.addList(perList);
		return ret;
	}
</pre>
<p>The code style is not as per the standards because, I have used SOP statements instead of Loggers. However above example is just getting clear that how to create the &#8220;Business Service&#8221; through Java. Now click on <strong>&#8220;Deploy&#8221;</strong> button to generate the new <strong>&#8220;cm.jar&#8221;</strong> and deploy.</p>
<figure id="attachment_2229" aria-describedby="caption-attachment-2229" style="width: 281px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Deploy-cm.jar-in-Eclipse-for-ORMB.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2229" title="Deploy cm.jar in Eclipse for ORMB / CC&amp;B / Oracle Utilities" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Deploy-cm.jar-in-Eclipse-for-ORMB.png?resize=281%2C163&#038;ssl=1" alt="Deploy cm.jar in Eclipse for ORMB / CC&amp;B / Oracle Utilities" width="281" height="163" /></a><figcaption id="caption-attachment-2229" class="wp-caption-text">Deploy cm.jar in Eclipse for ORMB</figcaption></figure>
<p>After successfully completion of the deployment, restart the application.</p>
<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; margin-top: 10px; color: #140b5c;">
<ol>
<li> <a style="color: #140b5c !important;" title="Creating Data Area in Oracle Utilities" href="https://jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/" target="_blank">Part 1 &#8211; Creating Data Area in Oracle Utilities </a></li>
<li> <a style="color: #140b5c !important;" title="Creating Business Service and Service Program in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/" target="_blank">Part 2 &#8211; Creating Business Service and Service Program </a></li>
<li> <a style="color: #140b5c !important;" title="Creating UI Map in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/" target="_blank"> Part 3 &#8211; UI Map in Oracle Utilities</a></li>
<li> <a style="color: #140b5c !important;" title="BPA Script in Oracle Utilities to invoke UI Map" href="https://jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/" target="_blank"> Part 4 &#8211; BPA Script in Oracle Utilities to invoke UI Map</a></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2207</post-id>	</item>
		<item>
		<title>Step by Step tutorial for creation of Business Service, Data Area, UI Map and BPA Script in ORMB / CC&#038;B / Oracle Utilities for beginners</title>
		<link>https://www.jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/</link>
					<comments>https://www.jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Tue, 14 Jun 2011 12:52:29 +0000</pubDate>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[CC&B /ORMB / SPL]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=2195</guid>

					<description><![CDATA[Step by Step tutorial for creation guide of Business Service, Data Area, UI Map and BPA Script in ORMB / CC&#038;B / Oracle Utilities for beginners]]></description>
										<content:encoded><![CDATA[<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; margin-top: 10px; color: #140b5c;">
<ol>
<li> <a style="color: #140b5c !important;" title="Creating Data Area in Oracle Utilities" href="https://jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/" target="_blank">Part 1 &#8211; Creating Data Area in Oracle Utilities </a></li>
<li> <a style="color: #140b5c !important;" title="Creating Business Service and Service Program in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/" target="_blank">Part 2 &#8211; Creating Business Service and Service Program </a></li>
<li> <a style="color: #140b5c !important;" title="Creating UI Map in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/" target="_blank"> Part 3 &#8211; UI Map in Oracle Utilities</a></li>
<li> <a style="color: #140b5c !important;" title="BPA Script in Oracle Utilities to invoke UI Map" href="https://jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/" target="_blank"> Part 4 &#8211; BPA Script in Oracle Utilities to invoke UI Map</a></li>
</ol>
</div>
<p>Before starting this demo application, I am assuming that you already have done CC&amp;B set up on your local and Eclipse is configured.<br />
What I am going to do so that I can use Business Script, Data Area, UI Map and BPA Script?<br />
In this tutorial, I will create one UI Map which will take the person name as input and display list of all the person names as per input.<br />
Final output screen would look like:</p>
<figure id="attachment_2198" aria-describedby="caption-attachment-2198" style="width: 399px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/UI-Map-in-ORMB-with-BPA-Script.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2198" title="UI Map in ORMB with BPA Script" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/UI-Map-in-ORMB-with-BPA-Script.png?resize=399%2C174&#038;ssl=1" alt="UI Map in ORMB/CC&amp;B/Oracle Utility with BPA Script" width="399" height="174" /></a><figcaption id="caption-attachment-2198" class="wp-caption-text">UI Map in ORMB/CC&amp;B/Oracle Utility with BPA Script</figcaption></figure>
<p><span id="more-2195"></span>We would start from creating the Data Area. &#8220;Data Area&#8221; in ORMB is used to transfer the data between applications. It is always good practice to use the Data Area rather than writing the Schema again and again. There are lots of advantages of using Data Area in application.<br />
To create Data Area, Go to &#8220;<strong>Menu (Alt + M) | Admin&#8221; Menu and in that &#8220;D | Data Area +</strong>&#8220;.</p>
<figure id="attachment_2202" aria-describedby="caption-attachment-2202" style="width: 501px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Admin-Menu-in-CCB.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2202" title="Admin Menu in CC&amp;B" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Admin-Menu-in-CCB.png?resize=501%2C512&#038;ssl=1" alt="Admin Menu in CC&amp;B / ORMB / Oracle Utility" width="501" height="512" /></a><figcaption id="caption-attachment-2202" class="wp-caption-text">Admin Menu in CC&amp;B</figcaption></figure>
<p>Give the Data Area Name and Description. In this case my Data Rea Name is <span style="text-decoration: underline;"><em>&#8220;PersonDataA&#8221;</em></span>. Now go to schema Tab and add below code:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;schema&gt;
    &lt;pageHeader type=&quot;group&quot;&gt;
        &lt;personName mapField=&quot;ENTITY_NAME&quot;/&gt;
    &lt;/pageHeader&gt;
    &lt;pageBody type=&quot;group&quot;&gt;
        &lt;PerNameList type=&quot;list&quot; mapList=&quot;PerNameList&quot;&gt;
            &lt;entityName mapField=&quot;ENTITY_NAME&quot;/&gt;
        &lt;/PerNameList&gt;
    &lt;/pageBody&gt;
&lt;/schema&gt;
</pre>
<p>To understand the Tag descriptions, use the Tips available at the right hand side as shown in below image:</p>
<figure id="attachment_2204" aria-describedby="caption-attachment-2204" style="width: 206px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Schema-Tips-in-ORMB.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-2204" title="Schema Tips in ORMB" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/06/Schema-Tips-in-ORMB.png?resize=206%2C125&#038;ssl=1" alt="Schema Tips in ORMB / CC&amp;B / Oracle Utilities" width="206" height="125" /></a><figcaption id="caption-attachment-2204" class="wp-caption-text">Schema Tips in ORMB</figcaption></figure>
<p>In the above schema I am passing the &#8220;ENTITY_NAME&#8221; in header (pageHeader) so that I can get the user input in request and in return (pageBody) user will have the List of Person Name.<br />
In Next article we will see how to create the Business Service and Service Program in ORMB.</p>
<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; margin-top: 10px; color: #140b5c;">
<ol>
<li> <a style="color: #140b5c !important;" title="Creating Data Area in Oracle Utilities" href="https://jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/" target="_blank">Part 1 &#8211; Creating Data Area in Oracle Utilities </a></li>
<li> <a style="color: #140b5c !important;" title="Creating Business Service and Service Program in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-business-service-and-service-program-in-ormb-ccb-oracle-utilities/" target="_blank">Part 2 &#8211; Creating Business Service and Service Program </a></li>
<li> <a style="color: #140b5c !important;" title="Creating UI Map in Oracle Utilities" href="https://jitendrazaa.com/blog/java/creating-ui-map-in-oracle-utilities/" target="_blank"> Part 3 &#8211; UI Map in Oracle Utilities</a></li>
<li> <a style="color: #140b5c !important;" title="BPA Script in Oracle Utilities to invoke UI Map" href="https://jitendrazaa.com/blog/java/create-bpa-script-in-oracle-utilities-to-invoke-ui-map/" target="_blank"> Part 4 &#8211; BPA Script in Oracle Utilities to invoke UI Map</a></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/step-by-step-tutorial-for-creation-guide-of-business-service-data-area-ui-map-and-bpa-script-in-ormb-ccb-oracle-utilities-for-beginners/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2195</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: www.jitendrazaa.com @ 2026-07-10 00:16:56 by W3 Total Cache
-->