Basic question - extending Serializable classes...

Hi everyone,
I've got a quick question: if I create a new class that extends a Serializable class, is that class automatically considered to be Serializable, or do I need to explicitly declare that?
Thank you in advance,
Pete

I've got a quick question: if I create a new class that extends a
Serializable class, is that class automatically considered to be
Serializable [ ... ]Yes, you're derived class is automagically considered to be Serializable.
This is what the API docs for the Serializable interface have to say
about it:
All subtypes of a serializable class are themselves serializable
kind regards,
Jos

Similar Messages

  • Some basic questions about serialization

    Hi,
    I have some basic questions on serialization.
    1. What are the basic criteria to make an object serializable(except that it must implement serializable ?) I mean that objects of some class inherently cannot be serialized so any object must have some features which makes it serializable/non serializable.
    2. I know it makes no sense to serialize a socket because it is fixed only by specifying ip and port at both ends, and is valid only when the network connection remains valid. Still in the context of my previous question, I would like to know why a socket cannot be serialized.

    Hi,
    I have problems to understand you question but will do a try:
    From a logical point of view objects can be only serialized reasonabely when they have a state of it's own which can be reestablished at a later point in time and space without further dependencies.
    F.E. a "serialized file" would NOT make much sense cause it depends heavily on the state of the underlying file system.
    You can't expected that is can be deserialized at a later point of time (physical file refered may not longer exists) or on another machine, where the serialized object was transported to.
    Technical - at zero approach - it's more or less trivial. Simply implement Serializable and all non static, non transient fields of your object will be serialized automatically.
    But there is a couple of pitfalls, you should study documentations regarding this feature.
    Hope this helps
    Martin

  • A basic question regarding derived class

    Hi,
    I am new to Java development, so this might be a very trivial question:
    class Base {
    public void b() {
    System.out.println("Base::b() method invoked");
    class Derived {
    public void d() {
    System.out.println("Derived::d() method invoked");
    class Testing1 {
    public static void main (String[] args) {
    Base val = new Derived();
    obj.d();
    I expected this to compile ( expecting d() to be treated as a virtual function). However I get an error message : "cannot find symbol : symbol d() : location: class Base".
    1. Is it possible to know where I went wrong ?
    2. How can I invoked d() method from val ?
    Regards,
    Anirvan

    two things I see are:
    1. obj isn't defined anywhere
    2. class derived should extend base by: class Derived extends Base
    Gregory

  • Basic question concernign EJB class

    Hi,
    I can not understand why a EJB bean class implements methods defined in the remote interface but not 'implements' that interface itself.
    who 'implements' that remote interface.
    thanks a lot for your time.
    Benjamin

    Hi !
    The remote inteface inturn has the signatures of all the methods present in the Bean class and not the vice versa and hence u see all the complete bussiness methods in the Bean interface.
    Hope i am clear
    Regards,
    Vin

  • A basic question of class

    Hello guys,
    i'm new hand and i got this question but i'm not sur of the answer, any help would be welcome :)
    The correct statement(s) are:
    a: a class is an instance factory
    b: a class is a template for creating an entity
    c: a class is a set of all the instances of a pattern
    d: none of the above

    It is A or B. I'm not sure which one though because it is a strange question.
    A class is a piece of code that creates objects. It's like a factory that produces a certain type of object. It is like the blueprints. Every building has blueprints. When the builders build a building they look at the blueprints to see how it is done. The compile looks at a class as blueprints on how to make something. Think of Terminator 2. One class would create the t1000 robots and another class would create the t2000 robots.
    I hope that helps. I think that A and B could be equally right.

  • Class Loading.Basic Question

    Hi,
    I wrote a small piece of code and it is running fine.
         Enumeration enP = lP.getNameList();
         int i=0;
         while (enP.hasMoreElements()) {
              Object nE = enP.nextElement();
              String nV = nE.toString();
              System.out.println(nV);
    I am in doubt,because as far as I know Enumeration is an interface as sucj an interface it is not supposed to have code. So, my question is which class is in fact been used by the program?

    All you can know it that whatever class it is, it
    implements the Enumeration interface. Well that's not really true. If you're really dying to
    now what type it truly is, just print out its
    class:Enumeration enP = lP.getNameList();
    System.out.println( enP.getClass() );
    That code shows what the class is on a specific version of a specific vendor's library. If you try to rely on that information, don't be surprised if it's a different class in another vendor's library or even the next version of the same vendor's library.
    The truth is you really don't know what class of object a reference will point to when you write the code, at least if the reference type is non-final.

  • ERROR: serializable class HelloComponent does not declare a static final

    Hi everyone! I'm sorry but I'm a newbie to Java and I'm having some, I assume, basic problems learning to compile and run with javac. Here is my code:
    import javax.swing.* ;
    import java.awt.* ;
    public class MyJava {
    * @param args
    public static void main(String[] args)
    // TODO Auto-generated method stub
    JFrame frame = new JFrame( "HelloJava" ) ;
    HelloComponent hello = new HelloComponent() ;
    frame.add( hello ) ;
    frame.setSize( 300, 300 ) ;
    frame.setVisible( true ) ;
    class HelloComponent extends JComponent
    public void paintComponent( Graphics g )
    g.drawString( "Hello Java it's me!", 125, 95 ) ;
    And here is the error:
    1. WARNING in HelloJava.java
    (at line 20)
    class HelloComponent extends JComponent {
    ^^^^^^^^^^^^^^
    The serializable class HelloComponent does not declare a static final serialVersionUID field of type long
    ANY HELP WOULD BE GREAT! THANKS! =)

    Every time I extend GameLoop, it gives me the warning
    serializable class X does not declare a static final serialVersionUID field of type long
    This is just a warning. You do not need to fix this because the class you are writing will never be serialized by the gaming engine. If you really want the warning to go away, add the code to your class:
    static final long serialVersionUID=0;

  • Two questions about defining class, pls help me

    Hi, guys. I'm green hand and here are two questions puzzled me several days.
    We know such example as below is a case of cyclic inheritance
    class Base extends Base{     
    But I can't figure out why below is a case of cyclic inheritance too
    class Base{
    class Derived extends Base{
    class Base{
    I can't find the clue of cyclic inheritance. It's quite different from the case that a class extends itself or its subclass.
    Another question is why the inner class can't have the same name of outer?
    class Base{
    class Base{          
    The compiler says Base is already defined in unnamed package. As it says, the inner class is defined in the
    unnamed package, but we know below is correct.
    class Base{
    class Basic{          
    class Derived {
    class Basic{
    We know it's correct. But as the compiler says above, the different two inner class Basic are both defined in the
    unnamed package. Why it's valid and why above is invalid?

    Hi,
    Can you tell us which product (s) you are referring to ? Can you also tell us the nature of your business requirements so that we can offer some suggestions ?
    Regards,
    Sandeep

  • One very basic question about inheritance

    One very basic question about inheritance.
    Why we need inheritance?
    the benefit of inheritance also achieve by creating instance of base class using it in other class instead of extending the base class.
    Can any one please explain why we are using inheritance instead of creating object of base class????

    SumitThokal wrote:
    One very basic question about inheritance.
    Why we need inheritance?
    the benefit of inheritance also achieve by creating instance of base class using it in other class instead of extending the base class.
    Can any one please explain why we are using inheritance instead of creating object of base class????What did you find out when you looked on Google?
    One example of inheritance comes in the form of a vehicle. Each vehicle has similarities however they differ in their own retrospect. A car is not a bus, a bus is not a truck, and a truck is not a motorbike. If you can define the similarities between these vehicles then you have a class in which you can extend into either of the previous mentioned vehicles. Resulting in a reusable class, dramatically reduces the size of code, creates a single point of definition, increases maintainability, you name it.
    In short there are thousands of benefits from using inheritance, listing the benefits could take a while. A quick Google search should give you a few hundred k if not million links to read.
    Mel

  • 11g 1.3 provides a new Serializable class warning ?

    We have an adf swing app we moved to version 1.3
    we now get this warning in most of the app classes:
    Serializable class contains non-serializable fields: [contactX]
    this is an example class as basic as you can get that extends JDialog and It uses another class. The warning wants to mark ContactX.class as transient ?
    This should not require the "private transient" Keyword as it has nothing to do with Jdialog being Serializable.
    Is this produced for some reason due to changes in use of the adf binding or
    has something changed that could impact the application now or in the future or is this warning in error?
    public class ContactXDialog extends JDialog {
    private ContactX contactX;
    }

    Ok I think I understand your confusion better now.
    - JDialog implements Serializable
    - You extends JDialog, so ContactXDialog also implements Serializable
    - Serialization implies the serialization of all fields, so contactX is a serialization candidate
    - Now there's two possibilities.
    1. contactX is calculable, meaning you can compute it back at runtime if needed, this is often the case of cached or lazy fetched values. Then you can make the field transient, effectively removing it from the serializable candidates
    2. contactX must be set, then it must be serialized, therefore it must be Serializable as well. So the only option here is to have ContactX class implement the Serializable interface.
    The warning offered the easiest way out, albeit likely a problematic one, to add the transient modifier.
    Regards,
    ~ Simon

  • Basic questions on data modeling

    Hi experts,
    I have some basic questions regarding data modeling within MDM. I understand the available table types and the concept of lookup fields. I know that the MDM data modeling concept is different to the relational concept. But having a strong database background my first step was to design a relational data model which I would like to transfer to a MDM repository. Unfortunately I didn't found good information material on this. So here are some questions maybe you can help me:
    1) Is it the right approach to model n:m relationships with multivalued lookup fields? E.g. main table Users with lookup field from subtable SapAccounts (a user can have accounts in different SAP systems, that means more than one account).
    2) Has a record always be unique in MDM repositories (e.g. should we use Auto ID's in every table or do we have to mark a combination of fields as unique)? Is a composite key of 2 or more fields represented with marking these fields as unique?
    3) The concept of relationships in MDM is only based on relationships between single records (not valid for all records in a table)? Is it necessary to define all relationships similar to the relational data model in MDM? Is there something similar to referential integrity in MDM?
    4) Is it possible to change the main table to a sub table later on if we realize that it has also to be used as a lookup table for another table (when extending the data model) or do we have to create a new repository from scratch?
    Thank you for your answers.
    Regards, bd

    Yes you are correct. It is almost difficult to map relational database to mdm one. But again MDM is not 'just' a database. It holds much more 'master' information as compared to any relational db.
    1) Is it the right approach to model n:m relationships with multivalued lookup fields? E.g. main table Users with lookup field from subtable SapAccounts (a user can have accounts in different SAP systems, that means more than one account).
    Yes Here you need to use MV look up tables or can also try Qualifier tables if it gets more complex
    2) Has a record always be unique in MDM repositories (e.g. should we use Auto ID's in every table or do we have to mark a combination of fields as unique)? Is a composite key of 2 or more fields represented with marking these fields as unique?
    Concept of uniqueness differs here that you also have something called Display Fields (DF). A combination of DF can also be treated as Unique one. For instance while importing records if you select these DF as a combination, you will eliminate any possible of duplicates based on this combination. Auto Id is one of the ways to have a unique id once record is within MDM. While you use UF or DF to eliminate any possible duplicates at import level
    3) The concept of relationships in MDM is only based on relationships between single records (not valid for all records in a table)? Is it necessary to define all relationships similar to the relational data model in MDM? Is there something similar to referential integrity in MDM?
    Hmm... good one. Referencial Integrity. What I assume you are talking is that if you have relationships between tables then removing a record will not be possible as it is a foreign key for some record. Here MDM does not allow that. As Relationships within MDM are physical and not conceptual. For instance material can have components. Now if material does not exist then any relationship to components is not worthwile to maintain. Hence relationshsip is eliminated.  While in relational model relationships are more conceptual. Hence with MDM usage of lookups and main table you do not need to maintain these kind of relationships on your own.
    4) Is it possible to change the main table to a sub table later on if we realize that it has also to be used as a lookup table for another table (when extending the data model) or do we have to create a new repository from scratch?
    No. It is not possible to convert main table. There is only one main table and it cannot be changed.
    I went for the same option but it did not work. What I suggest is to look up your legacy system one by one and see what fields in general can be classified as Master, Reference, Transactional - You will start getting answers immediately.

  • Basic question regarding SSIS 2010 Package where source is Microsoft Excel 97-2005 and there is no Microsoft office or Excel driver installed in Production

    Hi all,
    I got one basic question regarding SSIS 2010 Package where source is Microsoft Excel 97-2005. I wanted to know How this package works in production where there is no Microsoft office or Excel driver installed. To check that there is excel driver installed
    or not, I followed steps: Start-->Administrative Tools--> Data Sources(ODBC)-->Drivers and I found only 2 drivers one is SQL Server and another one is SQL Server Native Client 11.0.
    Windows edition is Windows Server 2008 R2 Enterprise, Service Pack-1 and System type is 64-bit Operating System.
    We are running this package from SQL Server Agent and using 32-bit (\\Machine_Name\d$\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\DTExec.exe /FILE "\\Machine_Name\d$\ Folder_Name\EtL.dtsx" /CONFIGFILE "\\Machine_Name\d$\Folder_Name\Config.dtsConfig"
    /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING E) to run this package. I opened the package and tried to find out what connection we have used and found that we have used "Excel Connection Manager" and ConnectionString=Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=F:\Fares.xls;Extended Properties="EXCEL 8.0;HDR=YES"; and source is ‘Excel Source’
    I discussed with my DBA and He said that SSIS is having inbuilt Excel driver but I am not convinced.
    Could anyone please clear my confusion/doubt?
    I have gone through various links but my doubt is still not clear.
    Quick Reference:
    SSIS in 32- and 64-bits
    http://toddmcdermid.blogspot.com.au/2009/10/quick-reference-ssis-in-32-and-64-bits.html
    Why do I get "product level is insufficient..." error when I run my SSIS package?
    http://blogs.msdn.com/b/michen/archive/2006/11/11/ssis-product-level-is-insufficient.aspx
    How to run SSIS Packages using 32-bit drivers on 64-bit machine
    http://help.pragmaticworks.com/dtsxchange/scr/FAQ%20-%20How%20to%20run%20SSIS%20Packages%20using%2032bit%20drivers%20on%2064bit%20machine.htm
    Troubleshooting OLE DB Provider Microsoft.ACE.OLEDB.12.0 is not registered Error when importing data from an Excel 2007 file to SQL Server 2008
    http://www.mytechmantra.com/LearnSQLServer/Troubleshoot_OLE_DB_Provider_Error_P1.html
    How Can I Get a List of the ODBC Drivers that are Installed on a Computer?
    http://blogs.technet.com/b/heyscriptingguy/archive/2005/07/07/how-can-i-get-a-list-of-the-odbc-drivers-that-are-installed-on-a-computer.aspx
    Thanks Shiven:) If Answer is Helpful, Please Vote

    Hi S Kumar Dubey,
    In SSIS, the Excel Source and Excel Destination natively use the Microsoft Jet 4.0 OLE DB Provider which is installed by SQL Server. The Microsoft Jet 4.0 OLE DB Provider deals with .xls files created by Excel 97-2003. To deal with .xlsx files created by
    Excel 2007, we need the Microsoft ACE OLEDB Provider. SQL Server doesn’t install the Microsoft ACE OLEDB Provider, to get it we can install the
    2007 Office System Driver: Data Connectivity Components or
    Microsoft Access Database Engine 2010 Redistributable or Microsoft Office suit.
    The drivers listed in the ODBC Data Source Administrator are ODBC drivers not OLEDB drivers, therefore, the Excel Source/Destination in SSIS won’t use the ODBC driver for Excel listed in it by default. On a 64-bit Windows platform, there are two versions
    of ODBC Data Source Administrator. The 64-bit ODBC Data Source Administrator is C:\Windows\System32\odbcad32.exe, while the 32-bit one is C:\Windows\SysWOW64\odbcad32.exe. The original 32-bit and 64-bit ODBC drivers are installed by the Windows operating system.
    By default, there are multiple 32-bit ODBC drivers and fewer 64-bit ODBC drivers installed on a 64-bit platform. To get more ODBC drivers, we can install the 2007 Office System Driver: Data Connectivity Components or Microsoft Access Database Engine 2010 Redistributable.
    Besides, please note that 2007 Office System Driver: Data Connectivity Components only install 32-bit ODBC and OLEDB drivers because it only has 32-bit version, but the Microsoft Access Database Engine 2010 Redistributable has both 32- bit version and 64-bit
    version.
    If you have any questions, please feel free to ask.
    Regards,
    Mike Yin
    TechNet Community Support

  • How to map a custom enum list to a custom form property in an extended incident class

    Hi,
    I'm struggeling to understand how to map a custom enum list to a custom form property in an extended incident class.
    Here's what i want to have happen:
    I am going to publish a request offering on my SMPortal for allowing users to submit basic IT incidents. I want the form to include "Whom does this problem affect" (answers(This is the custom enum list): Me, Multiple Users, Whole department or Whole
    company), "What is the problem about", "Description" and "Attachments".
    Here's what i've done:
    In the authoring tool i created a MP for the custom enum list and put only the list in it. I sealed the MP and imported it.
    I created another unsealed MP called TST.Incident.Library for storing incident library customizations and extended the incident class to add an extension class i called ClassExtension_Affected scope with a custom property i called AffectedScope. Then i am trying
    to set the datatype of this property to "list". In the "select a list" dialog i cannot chose my previously sealed MP with the custom enum list in it. Why?
    - Do i need to scratch the sealed MP and put the custom enum list in the latter TST.Incident.Library MP instead?
    - If so, can i do that and keep this MP unsealed, or will i get an error on import saying "Unsealed management packs should not contain type definitions"
    - Should i create one sealed MP for both the custom enum list and the extension class + custom property?

    Hi,
    Authoring Tool simply isn't informed about your list. Open the sealed management pack where you define the root of the list in the Authoring Tool and in the same time open TST.Incident.Library. You will have two opened MPs in the Authoring
    Tool and be able to add a custom list for your custom field.
    Cheers,
    Marat
    Site: www.scutils.com  Twitter:
      LinkedIn:
      Facebook:

  • Basic Questions on UITableView

    Hi, I'm trying to learn the iPhone API by creating a simple table application and I have some basic questions. There are stuff in the example code and the docs that seem to contradict, and I'm hoping some people can clarify.
    1) Table View Programming for iPhone OS, it says that UITableView must have a delegate and a source. I take it that in the example code (let's use TableCellSubivews) RootViewController is the source and TableViewCellSubviews is the delegate?
    2) If so, why does TableViewCellSubviews adopt the UIApplicationDelegate protocol and not UITableViewDelegate? In fact, I don't think any of the classes in the example code adopt UITableViewDelegate.
    3) In the UITableViewDelegate reference, it names didSelectRowAtIndexPath as a method. In the example code, why is in the didSelectRowAtIndexPath a method in the RootViewController, and not the delegate itself?
    Thanks for any explanations that anyone can give to help a noob!

    {quote}
    1) Table View Programming for iPhone OS, it says that UITableView must have a delegate and a source. I take it that in the example code (let's use TableCellSubivews) RootViewController is the source and TableViewCellSubviews is the delegate?
    {quote}
    There are 3 things that need to be done when setting up a tableview:
    1- the tableview controller itself, which determines how the tableview is set up, decides on the view, etc..
    2- the data source: the controller in 1) above needs to ask someone "give me the cell with the data for row #x. That's the job of the data source
    3- The delegate: some things for the table view need visible stuff such as the height of a row, whether a row should have a checkmark, etc... That's the job of the delegate.
    Now what often happens is that people do not specify a data source nor a delegate. What this means is that the controller performs all 3 jobs. Again, if the controller does not specify its delegate (or no class registers as its delegate), then the controller acts as its own delegate. (that answers your second question)
    {quote}
    3) In the UITableViewDelegate reference, it names didSelectRowAtIndexPath as a method. In the example code, why is in the didSelectRowAtIndexPath a method in the RootViewController, and not the delegate itself?
    {quote}
    That's a tricky question.
    The thing is that both the data source AND the delegate adopt a method called didSelectRowAtIndexPath. But they're for very different purposes. For the delegate, it's simply a notification by the controller that "hey, this row was selected, you may want to do something with it", i.e. change the color of the font, add a checkmark, etc...
    For the data source, it's much more important (and required!): the controller is saying "hey, someone requested row #x. Please give it to me!" This includes getting all the data and setting up the whole row, then returning it to the controller.
    Hope this helps clear things up.

  • Basic questions of structure Alchmy inside the AVM ans corePlayer ? Help!

    Hello community:)
    Flash Player 10 has been amended in order to run the new code from the compilation Alchemy! Is this correct?
    The new ABC Alchemy is for new features such as memory pointer, asynchronous functions? is that correct? and what else?
    This amendment consists of a small AVM separated from the Tamarin ? where everything is in Tamarin?
    The memory allocated to code from Alchemy is separated from the memory area allocated to the AVM and PlayerCore? it is like that?
    The CorePlayer flashRuntime and had to be changed?
    The ABC from Alchemy is intended only as to the AVM? or also to CorePlayer?
    Alchemy can access the BIOS? especially for 33h the mouse? if not, is it possible to control the mouse in one way or another with Alchemy?
    Immagine it would create a code C to produce sound from a bytesArray to replaceSampleData AS3 class, it's possible? If not, why? a restriction of the sandbox?
    Can be added directly to the assembler code using Alchemy? or it's prohibited because of the respect of cross platefrom?
    Thank you for maximum responses! although one can easily imagine some answers, I have confirmation:)
    Too many people claim things on forums, affirmative behave as if it was the system programmers themselves FlashPlayer! Outside, people sometimes give wrong answers! Two days ago, I had a guy who claimed that the AVM does not compile ABC! The ABC was executed directly .  It's sad and a shame to read such things. He obviously did not read and do not know the JIT
    This post is aimed at people on what they say and who were able to verify the information. Alchemy or programmers themselves.
    Thank you all!

    In order to understand things and not waste our time trying to code without knowing ifthey are not working because of am or even if it is because it is not impossible or not the player, I'm posted this on the forum Player. But my post is not answered .. Adobe programmers never come on this forum? Nobodyknows exactly how it works?
    Hello everyone
    I have some basic questions about the Flash player and  AVM2..
    I made this little flow chart for Player 9 and above >
    Can  anyone tell me if it is consistent and fair to me or to report a possible error?
    AVM2 the only accessing the CPU and Ram? and in no event in the device or OS API, right?
    The AVM2 in our current players is always a Tamarin?
    The next step is to replace the JIT by the nanoJIT spiderMonckey?
    The byteCode from Alchemy is well executed in the AVM and not elsewhere?
    The memory area codes assigned to Alchemy is the same as that of the AVM or is it different andseparate?
    Thank  you for your answers.
    Gordially,  Alain.

Maybe you are looking for

  • PreOrder & Network switch

    So my dad and i are currently on an expired family plan on t-mobile and were ready to switch networks so i plan to preorder an iPhone 4. I do have a few questions im not clear about... 1. how do i go about keeping my number and contacts? 2. how do we

  • Decode - total

    I have a crosstab report with one field that comes from a decode statement. The content of that field is either zero or the contents of a numeric field. I cannot total the field, cannot use cell sum, cannot count the field...Whatever I do comes out b

  • Mapping Buttons Disabled

    Hi, In my mapping programs the buttons "Map selected field and substrucutres if Names are identical", "Clear Mapping", "Data Flow editor"...... " are all disabled. These buttons are just below the Design, Test, Message Tabs. Ofcourse i am in Edit Mod

  • Could not restart  one node in 4 nodes rac server

    Hi Experts, we have 4 nodes oracle11.1 with ASM in Red hat. After reboot node2 sale2 server. I found all application is offline by crs_stat -t-v ora....SM2.asm application 0/5 0/0 ONLINE OFFLINE ora....DA.lsnr application 0/5 0/0 ONLINE OFFLINE ora..

  • Displaying 2 decimal places in BI Answers column, using SQL_TSI_HOUR

    Hi, Would anyone know why the following code refuses to display 2 decimal places in a BI answers report: ' case when "- Job Detail"."Date Delivered" is null or "- Job Detail"."Date Received" is null then 'Not Available' else cast (ROUND(cast(timestam