NOTE: If you want your table to be used in stagprop, Make sure table name doesnot exceed 18 CHAR length.
Creating new EJB :
Create Table:
1.
Do physical
mapping in RAD : Go to WebSphereCommerceServerExtensionsData > Data
Models > WCDEV.dbm à
Select DB2ADMIN schema. Rename it to NULLID
2.
Right-click
NULLID > Add Data Object > Table.
3.
Create ur table.
Right click on table and generate DDL. This ddl you can use to create table in
DB.
4.
Create the XOrderItemsBundles entity bean
4.1
In the Enterprise Explorer view, expand WebSphereCommerceServerExtensionsData.
4.2
Right-click Deployment Descriptor: WebSphereCommerceServerExtensionsData;
select New > Enterprise Bean
4.3
In the Create and Enterprise Bean window:
4.4
Select Entity bean with container-managed persistence (CMP) fields
In
the Source folder field, leave the default value, ejbModule.
In
the Default package field, enter com.ibm.commerce.extension.objects.
From
the CMP Version list, select 1.x.
5.
In the Enterprise
Bean Details window, add new CMP attributes for the OrederId,OrderItemsID etc.
5.1
Select the default CMP attribute id:java.lang.Integer and click Remove.
Click
Add.
5.2
In the Name field, enter OrederId.
5.3
In the Type field, enter java.lang.Long.
Note
: You must use the java.lang.Long data type, not the long data type, since the
column OrederId that you are trying to map to is BIGINT or NUMBER.
Select the Key Field check
box to indicate that this field is the primary
key of the database table.
Click Apply.
Same way for other field.
You must use the
java.lang.Integer data type, not the integer data type.
Ensure the Access with getter
and setter methods check box is selected. By selecting this option all getter
and setter methods will be automatically generated for all fields.
Clear the Access with getter
and setter methods check box.
Click Apply then Close to
close this window.
Ensure the Use the single key
attribute type for the key class check box is not selected, then click Next.
Ensuring this check box is not selected ensures that a key class is created,
ensuring consistency with other beans.
In the EJB Java Class Details
window, create the entity bean called Bonus:
To select the bean's
superclass, click Browse.
In the Type Selection window,
in the Select a class using: (any) field, enter ECEntityBean and click OK.
Specify the interfaces that
the remote interface should extend by clicking Add.
In the Type Selection window,
in the Select an interface using: (any) field, enter Protectable and click OK
to select com.ibm.commerce.security.Protectable. This interface is required in
order to protect the new resource under access control.
Click Next.
Deselect Add bean to Class
Diagram.
Click Finish.
Setting EJB properties : Set the EJB isolation level
WebSphereCommerceServerExtensionsData > Deployment
Descriptor > Entity Beans
- Right-click
On your bean and open the bean in its deployment descriptor.
- Click
the Access tab.
- Next
to the Isolation Level text box, click Add.
- In
the Add Isolation Level window, select Read committed, then
click Next.
- From
the Beans found list, select the Bonus bean,
then click Next.
- From
the Methods found list, select Bonus to
select all of its methods, and click Finish.
- Save
your changes and keep the editor open
Set the security
identity of the bean:
Ø
Select
the Access tab selected.
Ø
In the
Security Identity (Method Level) section, click Add.
Ø
Select
Use identity of EJB server, then click Next. The Use identity of EJB server
field ensures that all EJB beans run under the same identity for security.
Ø
From the
Beans found list, select the your bean, then click Next.
Ø
From the
Methods found list, select your bean to select all of its methods, and click
Finish.
Ø
Save your
changes and keep the editor open.
Remove the unused generated fields and methods. The
ECEntityBean base class provides its own implementation of these methods:
In the Java EE view, expand
WebSphereCommerceServerExtensionsData > Entity Beans > XOrderItemsBundlesBean
Open the XOrderItemsBundlesBeanclass for editing
Ø
In the Outline view removed the unused fields:
Ø
Select the myEntityCtx field and from its pop-up
menu, select Delete.
Ø
Select the getEntityContext() method and from
its pop-up menu, select Delete.
Ø
Select the setEntityContext(EntityContext)
method and from its pop-up menu, select Delete.
Ø
Select the unsetEntityContext() method and from
its pop-up menu, select Delete.
Add getter method for all primary key fields.
You can generate this method without having to type the
source. Right-click the catalogId property in the Outline view, and select
Source > Generate Getter and Setters. Select only the getOrderItemId()
method
In the Outline view, right-click the getOrderItemId method
and select Enterprise Bean (1.x-2.x) > Promote
to Remote Interface
Add Ejb finder :
- In
the EJB Deployment Descriptor editor, click the Bean tab.
- In
the Beans pane, select the XOrderItemsBundles bean.
- Click Add next
to the Finders text box, as in the following screen
capture:
Add ejbCreate and ejbPostCreate methods :
/**
* ejbCreate method for a CMP entity bean.
*/
public
com.XYZ.commerce.bundleorder.XOrderItemsBundlesKey ejbCreate(
java.lang.Long
orderItemsId,
java.lang.Long
bundleCatentryId,
java.lang.Long
ordersId,
java.lang.Long
catentryId,
java.lang.String
slot,
java.lang.String
field1,
java.lang.String
field2,
java.lang.Integer
field3) throws javax.ejb.CreateException {
this.initializeFields();
_initLinks();
this.orderItemsId
= orderItemsId;
this.bundleCatentryId
= bundleCatentryId;
this.ordersId
= ordersId;
this.catentryId=
catentryId;
this.slot
= slot;
this.field1
= field1;
this.field2
= field2;
this.field3
= field3;
XOrderItemsBundlesKey
bunKey = new XOrderItemsBundlesKey(orderItemsId,bundleCatentryId);
this.initializeOptCounter(bunKey);
return
null;
}
/**
* ejbPostCreate
*/
public
void ejbPostCreate(
java.lang.Long
orderItemsId,
java.lang.Long
bundleCatentryId,
java.lang.Long
ordersId,
java.lang.Long
catentryId,
java.lang.String
slot,
java.lang.String
field1,
java.lang.String
field2,
java.lang.Integer
field3) throws javax.ejb.CreateException {
}
In the Outline view, right-click the ejbCreate(Long,
Integer, Short, Integer, String) method you just created and select Enterprise
Bean (1.x-2.x) >Promote to Home
Interface
getOwner And fulfills method is not necessary till you have
foreign key to any table.
Create getter method for all primary key and in outline right click on getter method select Enterprise Bean > Promote to Remote Interface. Once this is complete, a small R icon displays next to the method, indicating that it has been promoted to the remote interface.
Create getter method for all primary key and in outline right click on getter method select Enterprise Bean > Promote to Remote Interface. Once this is complete, a small R icon displays next to the method, indicating that it has been promoted to the remote interface.
Map the database
table to the EJB :
In the Java EE
perspective Enterprise Explorer view, right-click WebSphereCommerceServerExtensionsData
and select Java EE > EJB to RDB Mapping (1.x-2.x) > Generate Map
Click finish. If you have preexisting folder :
In overview section by clicking all column you should get
field mapped.
Make the bean
portable and enable optimistic locking
Enable optimistic locking. Open the deployment descriptor
under WebSphereCommerceServerExtensionsData
In the Enterprise Explorer view, navigate to
WebSphereCommerceServerExtensionsData > Deployment Descriptor.
Ø
Open the deployment descriptor for editing.
Ø
In the Bean tab, select the your bean.
Ø
In the lower right pane, scroll down to the
Concurrency Control section.
Ø
Select Enable optimistic locking.
Ø
Save your changes.
Edit methods to call optimistic locking classes. In the XOrderItemsBundle
class make the following changes:
Ø
In the Outline view, select ejbLoad() and add
the following code as the first line in the method: super.ejbLoad();
Ø
In the Outline view, select ejbStore() and add
the following code as the first line in the method: super.ejbStore();
Ø
In the Outline view, select ejbCreate(Long,
Integer) and add the following code:
Ø
Add this.initializeFields(); as the first line
in the method.
Ø
Add the following two lines to the method before
the return statement
XOrderItemsBundlesKey bunKey = new
XOrderItemsBundlesKey(orderItemsId,bundleCatentryId);
this.initializeOptCounter(bunKey);
Ø
Save your changes.
Generate the Access
Bean for the EJB
In the Java EE perspective Enterprise Explorer view,
right-click WebSphereCommerceServerExtensionsData . Select New > Other. In
the list of options, expand EJB
and select Access Bean. Select Next.
On the Select an Access Bean Type page, select Copy helper .
Select Next
On the Select EJB Project page, select XOrderItemsBundles
bean.
Select Next.
On the Copy Helper
Access Bean page, for the Constructor method, select
findByPrimaryKey(com.ibm.commerce.extension.helpers.XPaperCatalog).
Select Finish.
Right-click WebSphereCommerceServerExtensionsData. Select Java
EE >Prepare for Deployment
Save all file.
"Great blog created by you. I read your blog, its best and useful information. You have done a great work. Super blogging and keep it up.php jobs in hyderabad.
ReplyDelete"
This is a nice post in an interesting line of content.Thanks for sharing this article, great way of bring this topic to discussion.
ReplyDeleteJava training in Chennai
Java training in Bangalore
Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
ReplyDeleteSelenium Training in Chennai Tamil Nadu | Selenium Training Institute in Chennai anna nagar | selenium training in chennai velachery
Selenium Training in Bangalore with placements | Best Selenium Training in Bangalore marathahalli
java training in chennai | java training in chennai Velachery |java training in chennai anna nagar
I really like the dear information you offer in your articles. I’m able to bookmark your site and show the kids check out up here generally. Im fairly positive theyre likely to be informed a great deal of new stuff here than anyone
ReplyDeleteData Science Training in Chennai
Data Science training in kalyan nagar
Data science training in Bangalore
Data Science training in marathahalli
Data Science interview questions and answers
Data science training in jaya nagar
Excellant post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
ReplyDeleteMicrosoft azure training in Bangalore
Power bi training in Chennai
good article. It is very useful for me to learn and understand easily. Thanks for sharing your good information and time.thanks lot!!
ReplyDeleteandroid training in chennai
android online training in chennai
android training in bangalore
android training in hyderabad
android Training in coimbatore
android training
android online training
This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points.
ReplyDeleteangular js training in chennai
angular js training in velachery
full stack training in chennai
full stack training in velachery
php training in chennai
php training in velachery
photoshop training in chennai
photoshop training in velachery
Interesting Post. It is really Nice and lovely post. keep it up. keep blogging. otherwise anyone wants to learn SAS training course
ReplyDeleteIBM Training in Bangalore
ucuz takipçi
ReplyDeleteucuz takipçi
tiktok izlenme satın al
binance güvenilir mi
okex güvenilir mi
paribu güvenilir mi
bitexen güvenilir mi
coinbase güvenilir mi
En son çıkan perde modelleri
ReplyDeletesms onay
mobil ödeme bozdurma
nft nasıl alınır
Ankara Evden Eve Nakliyat
Trafik Sigortasi
dedektor
web sitesi kurma
aşk kitapları
pendik mitsubishi klima servisi
ReplyDeletetuzla vestel klima servisi
tuzla bosch klima servisi
tuzla arçelik klima servisi
çekmeköy samsung klima servisi
ataşehir samsung klima servisi
çekmeköy mitsubishi klima servisi
ataşehir mitsubishi klima servisi
kadıköy vestel klima servisi