Friday, July 18, 2008

EJB Deployment Issue

I ran into this weird ejb deployment issue lately. It was a working EJB, then I had to add new remote methods to it. So I added them to the remote interface and to the actual java implementation class. Then when I deployed it locally, it some how doesnt seem to recognize my new methods, and when I access it, it simply throws NoSuchMethodFound error. After struggling for 1.5 days , (as though I dont have enough troubles..) figured out that I have an old client jar with the same .class file,(class I am trying to modify) and the server is picking up the classes from the lib folder evern before deploying my .class files in ejb-jar.

So server always tries to read files in the following order:
1) .class files from the lib folder
2) then any of classes in ur war files webroot/web-inf/classes folder

Also in EJB2.0, you dont need to create stubs and skeletons when you make changes and deploy your ear file,

Also when you provide a service jar to any of your remote service callers, all you porvide in the jar is

1) .class files with Home and Remote interfaces.
2) And no no stubs required. :)

You can generate this jar, by selecting the java classes in your eclipse rt click--> export as jar. I would recommned automate it in ur build file so you dont have to do it everytime. :)

-Coding Rocks.. !!!

Monday, July 14, 2008

SQL where Group by order by having

Writing Complex SQL and ordering.. squence in which the key words must be arranged to prevent SQL Command not properly ended error.


SELECT <> FROM
WHERE
GROUP BY
HAVING
ORDER BY


EXAMPLE:

SELECT P_OID,BASE_CR_FAC_ID,COUNT(*) FROM
V_A_FAC_P_ITEM
WHERE PROPOSAL_ITEM_APPR_STATUS_CODE = 'discarded'
GROUP BY BASE_C_FAC_ID,P_OID
HAVING COUNT(*) >1
ORDER BY P_OID desc


Further Reading: http://www.java2s.com/Code/SQL/Select-Clause/UsingmathfunctioninHAVING.htm
- SQL ROCKS..!!!