Tired of casting the return from ModelManager.getModel(), here is a tip
If you have been coding in JATO, you may have found yourself
frequently having to cast the value
returned by ModelManager.getModel(Class interfaceClass), in order to
operate on the returned model in the fashion you desire.
That is because ModelManager.getModel(Class interfaceClass) returns a
Model interface and in
the current version of the iMT, most of the Model interfaces are
under specified.
By underspecified I mean that the iMT translation tool could have
specified more interface support in each of the application specific
Model interface declarations.
For instance, take the migration of a MultiSQL data object in
NetDynamics.
e.g. MultiSQLProducts
The current version of the iMT translates this into a Model interface
and a corresponding implementation.
e.g. MultiSQLProductsModel and MultiSQLProductsModelImpl.
The current version of the iMT declares that
public interface MultiSQLProductModel extends QueryModel
while
public class MultiSQLProductModelImpl extends QueryModelBase
implements MultiSQLProductModel, SelectQueryModel,
InsertQueryModel, UpdateQueryModel, DeleteQueryModel
Now, this means that when you get a MultiSQLProductModel from the
ModelManager by calling ModelManager.getModel
(MultiSQLProductModel.class), you will get a
MultiSQLProductModelImpl object but you will have to cast the
returned value if you wish to take advantage of its SelectQueryModel,
InsertQueryModel, UpdateQueryModel, DeleteQueryModel capabilities.
This can be tiresome.
The remedy is that the interface declaration can be improved.
Specifically, we can rewrite the interface/impl declarations as
follows:
public interface MultiSQLProductModel extends QueryModel,
SelectQueryModel, InsertQueryModel,
UpdateQueryModel, DeleteQueryModel
public class MultiSQLProductModelImpl extends QueryModelBase
implements MultiSQLProductModel
This way when you call ModelManager.getModel
(MultiSQLProductModel.class), you will not have to cast the return in
order to take advantage of its its SelectQueryModel,
InsertQueryModel, UpdateQueryModel, DeleteQueryModel capabilities.
The next release of the iMT will translate code in this fashion.
The current translation style is not broken, nor will it be broken by
the next release of the iMT.
We are just giving current iMT users an FYI, so that you can manually
adjust your models IF you
wish to make your programming efforts lest cast intensive.
For those having problems with 10.4.x, try this link and see if any of their fixes address your problems. Apparently, there are several issues with
10.4.x that are unrelated to the fix for the 10.3.9 users that I posted.
Apple Mac OS X Intel - 10.4.9
http://www.macfixit.com/search.php?productID=29147
Apple Mac OS X PPC - 10.4.9
http://www.macfixit.com/search.php?productID=8848
Similar Messages
-
Revision: 1012
Author: [email protected]
Date: 2008-03-28 17:08:06 -0700 (Fri, 28 Mar 2008)
Log Message:
Merging change 1011 (for newer concurrent libraries which must be passed the return from
schedule, not the arg we passed into schedule).
Modified Paths:
blazeds/trunk/modules/core/src/java/flex/messaging/util/TimeoutManager.javaVerify from permission of user that you use it in upgrade, make sure that scom machine and user that you use it in upgrade in sysadmin group in database of operationsManager and OperationsManagerDW
Also Verify from Prerequisites of Upgrade SCOM 2012 sp1 as below link
http://technet.microsoft.com/en-us/library/jj656654.aspx
Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer" -
Just brought my daughter an iphone and have her setup on my ID. Want to be able to see her messages and photos but dont want my info to appear on her phone. How do i stop the messages from appearing on her phone?
If you have set up photo stream, this can't be done. As soon as you switch off photo stream on her device to keep your photos from coming to her device, you won't get any as well from her. Same for messages, you can't have both, sorry.
Maybe look into the family sharing feature if you want the photos to be shared:
Apple - iCloud - Family Sharing -
Movements types of the Returns from Customer
Hi Gurus,
Currently the Return Process from Customer is done using the movement type 651 that the batch quantity is posted in the Return Status but the finance people cannot see the finance values from this return before the transfer of the status.
Point 1:
I was wondering if you could inform me when I execute the movement type 453 that is transfer from Return status to Unrestricted Status they can see the finance values? Or to solve this point all returns must be done using the movement type 655 where the batch is posted in quality status and the finance people can see the finance values?
Point 2:
I am using the tcode MB1B for the movement type 453 to transfer the batch quantity from Return Status to Unrestricted Status but unfortunatelly the batch quantity is being posted for quality status.
In advance I would like to thank you for your attention. I'd be pleasure if you could give some tips for this process.
BR
ValdevairHi,
Use following procedure:
Create Return sales order(YERT), Post goods receipt(VL01N) and then post billing wrt sales order(VF01). Unless u create billing FI impact cannot be seen.
Regds-SRB -
Can the return from xsql:ref-cursor-function be saved & looped through XSQL?
If <xsql:ref-cursor-function> returns one field for a number of rows, is there a way to save those values and loop through the data retrieved for other query process within XSQL? Any example?
Thanks.
nullYou have a couple of options.
You can process the XML returned by <Xsql:ref-cursor-function> as the normal part of XSLT processing, or you can write a custom action handler that aggregates the action handler for <xsql:ref-cursor-function> and then uses DOM to operate on the return value.
Search the Online XSQL Pages Documentation for the term "MyIncludeXSQLHandler" for some sample code that illustrates building a customer action handler that aggregates one of the built-in handlers. -
Should I use the object returned from em.merge()
I am still confused how to use em.merge() correctly. I need to know if I should use the result of em.merge().
PersistentObject obj = new PersistentObject();
obj.setSomething("Value#1");
// Should I do this and continue to use the object returned from merge().
obj = em.merge(obj);
obj.setSomething("Value#2");Chris,
First thanks for your and your teams awesome support.
The reason I always get confused with merge() is my misunderstanding about how clones and caching are handled. Let me give you 2 scenerios and could you tell me what the problems are, is any?
Scenerio #1: (using return from merge)
-- Start of Transaction #1
EntityObject obj = new EntityObject();
obj.setName("chris");
obj = em.merge(obj);
-- End of Transaction #1
-- Start of Transaction #2
obj.setName("scott");
obj = em.merge(obj);
-- End of Transaction #2
Is this ok, will I lose data, are the clones and cache ok?
Scenerio #2: (NOT using return from merge)
-- Start of Transaction #1
EntityObject obj = new EntityObject();
obj.setName("chris");
em.merge(obj);
-- End of Transaction #1
-- Start of Transaction #2
obj.setName("scott");
em.merge(obj);
-- End of Transaction #2
Is this ok, ?
These 2 scenerios are different in the fact that one uses the return from merge and one does not. Which one is correct, and what would the problem be with the wrong one? -
Change "Return-From" field in mail.app messages
I need to be able to change the "Return-From" field in some of my outbound emails using the mail.app. I can't find a way to do this. Can anyone help? Here is what I am basically trying to accomplish:
I need recipients of the email to be able to select Reply and have the email come back to the same email address as the From field, but if they have an out of office turned on, or if the email is no longer a valid email address, I need those messages to go to a different email box so they don't clutter up the real messages that need to be worked.
Any suggestions or ideas are appreciated.You can add any headers you want to Mail, with the defaults write com.apple.mail UserHeaders command in Terminal. However, it is easy to get it wrong, particularly if you already have added headers, so I would suggest you try Cricket's Applescripts for Mail, which includes one for doing it.
That said, is there a Return-From header? I cannot recall having noticed one.
AK -
Return from customer to unrestricted stock
Dear Expert,
is there is a way to make the return from the customer from return order to be back to unrestricted stockHi,
No, you can't make the return from customer to the unrestricted stock directly! At least the returned stock must go to the return stock, this is the standard process. After confirmation with quality departement, you can decide the returned stock goes to unrestricted stock, block stock or srcap directly! That's it!
Good day
Tao -
Hi
How to handle the returns from the export sale?
How the cycle flow will be?
Is it similar to domestic returns
regards
rithvikaDear Rithvika
Yes as like domestic, you need to create the following documents
- Create a return order
- Create a return delivery (if goods are returned from overseas country)
- Issue a credit note
- Excise adjustments in J1IH
For this, you need to have copy controls
- from billing to return order in VTAF
- from return order to return delivery in VTLA
- from return delivery to credit note in VTFL
- from return order to credit note in VTFA
thanks
G. Lakshmipathi -
Extra element in XMLBean doc returned from DBControl!
Hi,
I am returning XMLBeans from a DBControl. The returned XMLBean has an extra element in it that was not defined in the schema for the bean. Here's the schema that is defined:
<xs:complexType name="CompanyCoreDetailsType">
<xs:sequence>
<xs:element name="accountNo"/>
<xs:element name="companyName"/>
<xs:element name="companyNameDisp"/>
<xs:element name="address1"/>
<xs:element name="address2"/>
<xs:element name="address3"/>
<xs:element name="city"/>
<xs:element name="state"/>
<xs:element name="zip"/>
<xs:element name="country"/>
<xs:element name="website"/>
<xs:element name="regionID"/>
<xs:element name="regionName"/>
<xs:element name="hiringSummer"/>
<xs:element name="hiringFullTime"/>
<xs:element name="recruitingNotes"/>
<xs:element name="recruitingNotesDate"/>
<xs:element name="hiringInfoSource"/>
<xs:element name="overviewFileName"/>
<xs:element name="stockSymbol"/>
<xs:element name="active"/>
<xs:element name="forceToWeb"/>
<xs:element name="numCompanyContacts"/>
<xs:element name="numStudentContacts"/>
<xs:element name="numInsights"/>
<xs:element name="reviewDate"/>
<xs:element name="lastDate"/>
</xs:sequence>
</xs:complexType>
And here's the return from the DBControl:
Return value: <CompanyCoreDetails xmlns="http://gsb.stanford/valobj" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<accountNo>
<ACCOUNTNO>A2100856964%5:0E/Mai</ACCOUNTNO>
<COMPANYNAME>AAAAAA</COMPANYNAME>
<COMPANYNAMEDISP>AAAAAA</COMPANYNAMEDISP>
<ADDRESS1>Mother Ignacia Street</ADDRESS1>
<ADDRESS2 xsi:nil="true"/>
<ADDRESS3 xsi:nil="true"/>
<CITY>Quezon City</CITY>
<STATE xsi:nil="true"/>
<ZIP/>
<COUNTRY>Philippines</COUNTRY>
<WEBSITE>www.aaaaaa.com</WEBSITE>
<REGIONID>2</REGIONID>
<REGIONNAME>Asia/Australia</REGIONNAME>
<HIRINGSUMMER xsi:nil="true"/>
<HIRINGFULLTIME xsi:nil="true"/>
<RECRUITINGNOTES xsi:nil="true"/>
<RECRUITINGNOTESDATE xsi:nil="true"/>
<HIRINGINFOSOURCE xsi:nil="true"/>
<OVERVIEWFILENAME xsi:nil="true"/>
<STOCKSYMBOL xsi:nil="true"/>
<ACTIVE>Active</ACTIVE>
<FORCETOWEB>No</FORCETOWEB>
<NUMCOMPANYCONTACTS>1</NUMCOMPANYCONTACTS>
<NUMSTUDENTCONTACTS>0</NUMSTUDENTCONTACTS>
<NUMINSIGHTS>0</NUMINSIGHTS>
<REVIEWDATE xsi:nil="true"/>
<LASTDATE>2005-06-07T14:29:00-07:00</LASTDATE>
</accountNo>
</CompanyCoreDetails>
Notice the extra <accountNo> element which is added and wraps most of the other elements.
The db control is calling a stored procedure which returns all the elements defined in the schema in the same order. The names of the elements are the same, but the case is different. The SP does return something called ACCOUNTNO which looks like it's interpreted correctly.
Thank you,
MaxJennifer,
Here's the code for the db control... let me know what else you need and thanks for looking into this.
* Defines a new database control.
* The @jc:connection tag indicates which WebLogic data source will be used by
* this database control. Please change this to suit your needs. You can see a
* list of available data sources by going to the WebLogic console in a browser
* (typically http://localhost:7001/console) and clicking Services, JDBC,
* Data Sources.
* @jc:connection data-source-jndi-name="CIDBDataSource"
public interface CompanyDBControl extends DatabaseControl, com.bea.control.ControlExtension
static final long serialVersionUID = 1L;
* @jc:sql statement="exec s_gm_company_criteria_search {industries}, {regions}, {jobFunctions}"
CompanySearchResultCltnDocument criteriaSearch(String industries, String regions, String jobFunctions);
* @jc:sql statement="exec s_gm_company_alpha_search {alpha}"
CompanySearchResultCltnDocument alphaSearch(String alpha);
* @jc:sql statement="exec s_gm_company_name_search {name}"
CompanySearchResultCltnDocument nameSearch(String name);
* @jc:sql statement="exec s_gm_get_company_info {accountNo}"
CompanyCoreDetailsDocument getCoreCompanyDetails(String accountNo);
* @jc:sql statement="exec s_gm_get_company_cmc_contacts {accountNo}"
CompanyCMCContactsCltnDocument getCompanyCMCContacts(String accountNo);
* @jc:sql statement="exec s_gm_get_company_student_contacts {accountNo}"
CompanyStudentContactsCltnDocument getCompanyStudentContacts(String accountNo);
* @jc:sql statement="exec s_gm_get_company_insights {accountNo}"
CompanyInsightsCltnDocument getCompanyInsights(String accountNo);
} -
Re:How to get the vo from managed bean
Hi all,
I am using Jdev11.1.2.3.0
My requirement is : I have one jspx page.In that page i have created one form,so i need to get the values from managed bean.here i wont create by using data control view instance.so finally i have to get the table values from managed bean.so how can i get it.can anyone help me please.
Thanks,
G.ShilpaSo you're not using ADF BC at all, right ?
From JSF point of view, it does not matter how you provide UI control values.
What you can do, for example, is to use pure JDBC in order to get and display the database values.
What you need in your backing bean, is appropriate properties (setter/getter method pairs).
In the getter, you can obtain DB values by using JDBC
Take a look at:
JSF 2.0 + JDBC integration example
JSF JDBC Integration
JDBC in JSF - YouTube -
To Select the data from two table one is transp table and onther is cluster
Hi All,
I want to select the data from two tables
Here i am giving with an example.
Fileds: kunnr belnr from bseg. table bseg
fields: adrnr from kna1 table: kna1.
Know i want to put these into one internal table based on kunnr and belnr.
Thanks in advance.
RameshHi,
U cant use joins on cluster table and BSEG is a cluster table so use FOR ALL ENTRIES for taht
refer this code
*& Form sub_read_bsak
text
--> p1 text
<-- p2 text
FORM sub_read_bsak.
*--Select data from BSAK Table
SELECT lifnr
augdt
augbl
gjahr
belnr
xblnr
blart
dmbtr
mwskz
mwsts
sgtxt
FROM bsak
INTO CORRESPONDING FIELDS OF TABLE it_bsak
WHERE belnr IN s_belnr
AND augdt IN s_augdt.
IF sy-subrc EQ 0.
*--Sort table by accounting document and vendor number
SORT it_bsak BY belnr lifnr.
ENDIF.
ENDFORM. " sub_read_bsak
*& Form sub_read_bseg
text
--> p1 text
<-- p2 text
FORM sub_read_bseg.
IF NOT it_bsak[] IS INITIAL.
*--Select data from BSEG table
SELECT belnr
gjahr
shkzg
kostl
hkont
ebeln
ebelp
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg
FOR ALL ENTRIES IN it_bsak
WHERE belnr EQ it_bsak-belnr
AND gjahr EQ it_bsak-gjahr
AND shkzg EQ 'S'.
IF sy-subrc EQ 0.
*--Sort table by accounting document
SORT it_bseg BY belnr.
ENDIF.
ENDIF.
ENDFORM. " sub_read_bseg -
Fetch the netprice from the validity period which always matches with the
Let me describe the same.
Suppose the PO creation date is 04.07.2007
The conditions for an item in a contract for the PO are as follows;
1. Validity from 04.07.2007 validity to 04.07.2007 Netprice = 100.00
2. Validity from 05.07.2007 validity to 31.12.9999 Netprice = 200.00
We need to always fetch the netprice from the validity period which always matches with the PO creation date. here the value 100.00 should be the correct netpr as the PO creation date matches with the first validity period.
But the program is fetching the netprice 200.000 which belongs to the second validity period. That is beacuse the select statement which fetches the data for contracts collects on the basis of EKKO-kdate and ekko-kdtab.the fields kdate and kdtab retrieves the validity period of the contract which is from 04.07.2007 to 31.072007. This data is then used to retrieve the netpr data from EKPO and it fetched 200.00 as it retrives the netprice of current data in contract validity and h not with respect to PO creation date.
This data is then used to fetch the get the netpr data from EKPO.
what we need is the netprice for that validity period of item(Conditions) that matches with the PO creation date..
Below is the code where I'm selecting the data from ekko and ekpo for the contracts data..Can you please add the code snippet to the below attachesd subroutine to get the required data from KONV and KONP so that we can retrieve the correct Netprice.
FORM select_contracts USING p_s_cebeln LIKE s_cebeln[]
p_c_k_bstyp TYPE ebstyp
p_p_bukrs TYPE bukrs
p_p_ekorg TYPE ekorg
p_p_ekgrp TYPE bkgrp
*Begin of Mod-004
fp_p_cernam type ty_r_ernam
p_p_cernam TYPE ernam
*End of Mod-004
p_s_werks LIKE s_werks[]
p_s_matnr LIKE s_matnr[]
p_s_lifnr LIKE s_lifnr[]
p_s_val_dt LIKE s_val_dt[].
*mod-002
data : l_amount type BAPICURR_D, " Net price
l_waers TYPE waers, " Currency Key
l_eff_amount type BAPICURR_D. " Effective value
data: l_v_netpr type bprei.
*mod-002
SELECT ebeln
bukrs
bstyp
aedat
ernam
lifnr
zterm
ekorg
ekgrp
waers
wkurs
kdatb
kdate
inco1
INTO TABLE i_ekko
FROM ekko
WHERE ebeln IN p_s_cebeln
AND bstyp EQ p_c_k_bstyp
AND bukrs EQ p_p_bukrs
AND ekorg EQ p_p_ekorg
AND ekgrp EQ p_p_ekgrp
*Begin of Mod-004
AND ernam EQ p_p_cernam
AND ernam IN fp_p_cernam
*End of Mod-004
AND lifnr IN p_s_lifnr
AND ( kdatb IN p_s_val_dt OR kdate IN p_s_val_dt ).
IF sy-subrc EQ 0.
Populates internal table i_ekpo using EKPO table.
SELECT ebeln
ebelp
loekz
txz01
matnr
werks
ktmng
menge
meins
bprme
netpr
peinh
webaz
mwskz
uebto
untto
erekz
pstyp
knttp
repos
webre
konnr
ktpnr
ean11
effwr
xersy
aedat
prdat
INTO TABLE i_ekpo
FROM ekpo
FOR ALL ENTRIES IN i_ekko
WHERE ebeln = i_ekko-ebeln
and aedat = i_ekko-aedat
AND werks IN p_s_werks
AND matnr IN p_s_matnr.
LOOP AT i_ekpo INTO rec_ekpo.
MOVE rec_ekpo-ebeln TO rec_contr-ebeln.
MOVE rec_ekpo-ebelp TO rec_contr-ebelp.
MOVE rec_ekpo-loekz TO rec_contr-loekz.
MOVE rec_ekpo-txz01 TO rec_contr-txz01.
MOVE rec_ekpo-matnr TO rec_contr-matnr.
MOVE rec_ekpo-werks TO rec_contr-werks.
MOVE rec_ekpo-ktmng TO rec_contr-ktmng.
MOVE rec_ekpo-menge TO rec_contr-menge.
MOVE rec_ekpo-meins TO rec_contr-meins.
MOVE rec_ekpo-bprme TO rec_contr-bprme.
MOVE rec_ekpo-netpr TO rec_contr-netpr.
move l_v_netpr TO rec_contr-netpr.
mod-002
read table i_ekko into rec_ekko with key
ebeln = rec_ekpo-ebeln.
l_waers = rec_ekko-waers.
CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
EXPORTING
currency = l_waers
amount_internal = rec_contr-netpr
IMPORTING
AMOUNT_EXTERNAL = l_amount.
rec_contr-netpr = l_amount.
mod-002
MOVE rec_ekpo-peinh TO rec_contr-peinh.
MOVE rec_ekpo-webaz TO rec_contr-webaz.
MOVE rec_ekpo-mwskz TO rec_contr-mwskz.
MOVE rec_ekpo-uebto TO rec_contr-uebto.
MOVE rec_ekpo-untto TO rec_contr-untto.
MOVE rec_ekpo-erekz TO rec_contr-erekz.
MOVE rec_ekpo-pstyp TO rec_contr-pstyp.
MOVE rec_ekpo-knttp TO rec_contr-knttp.
MOVE rec_ekpo-repos TO rec_contr-repos.
MOVE rec_ekpo-webre TO rec_contr-webre.
MOVE rec_ekpo-konnr TO rec_contr-konnr.
MOVE rec_ekpo-ktpnr TO rec_contr-ktpnr.
MOVE rec_ekpo-ean11 TO rec_contr-ean11.
MOVE rec_ekpo-effwr TO rec_contr-effwr.
mod-002
CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
EXPORTING
currency = l_waers
amount_internal = rec_contr-effwr
IMPORTING
AMOUNT_EXTERNAL = l_eff_amount.
rec_contr-effwr = l_eff_amount.
*mod-002
MOVE rec_ekpo-xersy TO rec_contr-xersy.
APPEND rec_contr TO i_contr.
CLEAR: rec_ekpo,rec_contr.
mod-002
CLEAR : rec_ekko,l_amount, l_eff_amount,l_waers.
mod-002
ENDLOOP.
Modifying i_contr using i_ekko.
SORT i_ekko BY ebeln.
LOOP AT i_contr INTO rec_contr.
READ TABLE i_ekko INTO rec_ekko WITH KEY
ebeln = rec_contr-ebeln
BINARY SEARCH.
MOVE rec_ekko-bukrs TO rec_contr-bukrs.
MOVE rec_ekko-bstyp TO rec_contr-bstyp.
MOVE rec_ekko-aedat TO rec_contr-aedat.
MOVE rec_ekko-ernam TO rec_contr-ernam.
MOVE rec_ekko-lifnr TO rec_contr-lifnr.
MOVE rec_ekko-zterm TO rec_contr-zterm.
MOVE rec_ekko-ekorg TO rec_contr-ekorg.
MOVE rec_ekko-ekgrp TO rec_contr-ekgrp.
MOVE rec_ekko-waers TO rec_contr-waers.
MOVE rec_ekko-wkurs TO rec_contr-wkurs.
MOVE rec_ekko-kdatb TO rec_contr-kdatb.
MOVE rec_ekko-kdate TO rec_contr-kdate.
MOVE rec_ekko-inco1 TO rec_contr-inco1.
MODIFY i_contr FROM rec_contr.
ENDLOOP.
ENDIF.
REFRESH: i_ekko,
i_ekpo.
CLEAR : rec_ekko,
rec_ekpo,
rec_contr.
ENDFORM. "select_contracts
Thanks.Hi,
Please get the valid condition ( based on date ) from A016 (MK & LPA). With the appropriate KNUMH read the Condition header. You can access the different condition items viz., PB00, RA00 etc., for the values from table KONP. Further if you have Value scales / Quantity scales, you can read the data from KONM, KONW.
An additional tips: in KONP, if you have a condition like RA00 - Rebate, the value will be multiplied by 10 and saven in database to accomodate the discount to the third decimal.
I could not completely understand your requirements like nature of development ( Is it a Report / SAP Script ??) you are working etc., so that I could help you precisely.
Hope this helps,
Best Regards, Murugesh AS
Message was edited by:
Murugesh Arcot -
EJB3 Stateful:ClassCastException when casting the object returned in lookup
Hi,
I'm developing a web application that make use of EJB3 stateless and stateful beans. The application server is the Websphere Application Server 6.1.0.15 with the EJB3 Feature Pack installed and the web server is the IBM HTTP Server running in another machine.
The problem I'm facing is that for every stateful bean after the lookup, it throws a ClassCastExcption when casting the object returned. See part of the log below.
[7/13/08 3:15:48:869 CDT] 0000001c SystemErr R java.lang.ClassCastException: cannot cast class com.spcs.dsa.ejb.authenticationmanager._AuthenticationManager_Stub to class com.spcs.dsa.ejb.authenticationmanager._AuthenticationManager_Stub
at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:396)
at com.spcs.dsa.ejb.client.DsaEjbClient.getAuthenticationRemote(DsaEjbClient.java:37)
at com.spcs.dsa.action.NewCardAction.execute(NewCardAction.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
Please notice in the log above that the cast was done for the correct class.
Here is the java code:
AuthenticationManager auth =
(AuthenticationManager) javax.rmi.PortableRemoteObject.narrow(
context.lookup("com.spcs.dsa.ejb.authenticationmanager.AuthenticationManager"),
AuthenticationManagerStub.class);
This problem doesn't happen for statless beans. If you simply change the class to be stateless, this problem stop to happen.
If you run this code in a stand alone program, this problem doesn't happen. It only happen when running in the web server.
Does anybody know what should be done to solve this problem ??
Thanks,
Marcos.I'm not familiar with any specifics of IBM's implementation but from an EJB 3 spec perspective there is no need to use PortableRemoteObject.narrow() if you're retrieving an EJB 3.0 Remote Business interface, regardless of the component type( stateful vs. stateless). In addition, the "_Stub" class should never have to be part of your client programming model. That should be hidden within the vendor's implementation, if present at all.
If AuthenticationManager is the Remote 3.0 Business Interface
@Remote
public interface AuthenticationManager {
your client lookup should be :
AuthenticationManager am = (AuthenticationManager) context.lookup("..."); -
Problem with the return value from a tablemodel after filtering
I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
**** This is the code to fill the jtable
DefaultTableModel modelo=(DefaultTableModel)this.jTable1.getModel();
while(rs.next()){
Object[] fila= new Object[2];
fila[0]=rs.getObject("id_categoria");
fila[1]=rs.getObject("nombre");
modelo.addRow(fila);
this.jTable1.getColumnModel().removeColumn(this.jTable1.getColumnModel().getColumn(0));
// I delete the first column because is a ID, I dont want that the user see it. the value is only for me**** this is the method to filter from the jtextfield
private void FiltrarJtable1() {
TableRowSorter sorter = new TableRowSorter(this.jTable1.getModel());
sorter.setRowFilter(RowFilter.regexFilter("^"+this.jTextField1.getText().toUpperCase(), 1));
this.jTable1.setRowSorter(sorter);
this.jTable1.convertRowIndexToModel(0);
}*** this is the method that return the ID (id_categoria) from the tablemodel
private void SeleccionarRegistro(){
if(this.jTable1.getSelectedRow()>-1){
String str_id =this.jTable1.getModel().getValueAt(this.jTable1.getSelectedRow(),0).toString();
int_idtoreturn=Integer.parseInt(str_id);
this.dispose();
}else{
JOptionPane.showMessageDialog(this,"there are no records selected","Warning!",1);
}Who I can solve this problem?m_ilio wrote:
I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
You're right in that you have to use convertRowIndexToModel(), but you are using it wrong. That method takes as input the index of a row in the view, i.e. the table, and returns the corresponding row in the underlying TableModel. No data is changed by the call, so this:
this.jTable1.convertRowIndexToModel(0);is meaningless by itself.
What you need to do is the following:
int selectedRow = this.jTable1.getSelectedRow(); // This is the selected row in the view
if (selectedRow >= 0) {
int modelRow = this.jTable1.convertRowIndexToModel(selectedRow); // This is the corresponding row in the model
String str_id =this.jTable1.getModel().getValueAt(modelRow, 0).toString();
}Hope this helps.
Maybe you are looking for
-
After updating to iOS 8.2, messaging application is unstable
I have updated my iPhone 5 to iOS 8.2 and when I now go into the Messaging application and decide to delete a message thread, the whole messaging application is very slow and then all of a sudden all my message are gone. This has happened 3 times sin
-
Solution (sort of) to "Load Indicator not supported by OS" problem
During database creation, even if you choose "Dedicated Server Mode" instead of "Shared Server Mode" (for MTS), you will actually be using dedicated server processes for Net8 BUT you will still use MTS for IIOP connections. That's why you have those
-
Before the newest update my songs were playing fine, no hassle. After a restart to make iTunes properly download the update the sound on my tracks in now crackly. I thought it was my headphones so used 3 pairs and also played various tracks from my l
-
Unable to start OEM in Oracle 10g
Hi, We are just change the system time from today to last month 6-June, After change the time, the OEM unable to start. How can I solve it ? Regards
-
Dynamic updates in dropdown field using presentation
My requirement is as follows: 1) Combination of text box & dropdown in the presentation. 2) Dropdown is dependent on the text box. 3) If user will enter the two characters in the text box then automatically drop down will be fill the list