Re: serialVersionUID in Session EJB & JMS (and Jace/JNI)

Juan Pablo Lorandi <[email protected]>
Newsgroups gmane.comp.java.sun.ejb.general
Organization CodeFoundry LTD
Message-ID <00c501c3e37c$8a82e5b0$0a00a8c0@rifle>
> I'm not sure exactly how the mismatch occurs, but it seems to 
> happen even when I've not made a change in the interfaces and 
> there's no Jace build involved. Strangely enough, this 
> problem sometiimes goes away upon restarting both the client 
> and app server - but not always, and when it persists, the 
> only solution is to do a complete rebuild of the GUI 
> (starting with the Jace/JNI
> build)- which takes hours!

Ok, here's the problem: you NEVER get a reference to any of the Bean
classes. Depending on the type of Bean, the app server, etc. you either
get:
A) A class EXTENDING your class
B) A class containing/delegating to an instance of your class

Or a combination. Thus, you manually specifying the serialVersionUID in
one of your classes is probably useless. I'd try then to create some
Java classes which façade the access to Session beans and JMS. I'd run
Jace on them to create the proxies, and use them from the code.

> I understand that the solution is to declare a cust
> om serialVersionUID
> constant in the code.
> My questions are:
> 1. In which file should I declare the constant (a) for 
> session EJBs? (b) for JMS? 

Can't do that, since the instances you get on the front end are from
classes generated by the container.

> 2. What's the best method to 
> manage it's value? Since it's an explicit constant in the 
> code, I don't think I can change it in the build process 
> without manually modifying each source file that contains the
> serialVersionUID- or can I?

No, you'd have to add it to each source file.

> 3. Should I maintain a separate version for each file or just 
> one value for the current build version?

Each different class should have its own serialVersionUID.

HTH,

JP

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.