Results 1 to 2 of 2
  1. #1
    MamboBanda is offline Member
    Join Date
    Aug 2008
    Posts
    1
    Rep Power
    0

    Default Object not serializing

    I'm trying to serialize a class and it's not loading the data. I save it to file and try to load it and all I get is null's. The class is a composite in another class. here is the code. What am I doing wrong.

    Java Code:
    public class hibernateConfig implements java.io.Serializable{
       
        public String hibernate_connection_driver_class;
        public String hibernate_connection_url;	
        public String hibernate_connection_username;	
        public String hibernate_connection_password;	
        public String hibernate_connection_pool_size;
        
        public String hibernate_dialect;
        public String hibernate_show_sql;
        public String hibernate_format_sql;
        public String hibernate_default_schema;
        public String hibernate_default_catalog;
        public String hibernate_session_factory_name;
        public String hibernate_max_fetch_depth;
        public String hibernate_default_batch_fetch_size;
        public String hibernate_default_entity_mode;
        public String hibernate_order_updates;
        public String hibernate_generate_statistics;
        public String hibernate_use_identifer_rollback;
        public String hibernate_use_sql_comments;
        
        public String hibernate_jdbc_fetch_size;
        public String hibernate_jdbc_batch_size;
        public String hibernate_jdbc_batch_versioned_data;
        public String hibernate_jdbc_factory_class;
        public String hibernate_jdbc_use_scrollable_resultset;
        public String hibernate_jdbc_use_streams_for_binary;
        public String hibernate_jdbc_use_get_generated_keys;
        public String hibernate_connection_provider_class;
        public String hibernate_connection_isolation;
        public String hibernate_connection_autocommit;
        public String hibernate_connection_release_mode;
        
        public String hibernate_cache_provider_class;
        public String hibernate_cache_use_minimal_puts;
        public String hibernate_cache_use_query_cache;
        public String hibernate_cache_use_second_level_cache;
        public String hibernate_cache_query_cache_factory;
        public String hibernate_cache_region_prefix;
        public String hibernate_cache_use_structured_entries;
        
        public String hibernate_transaction_factory_class;
        public String jta_UserTransaction;
        public String hibernate_transaction_manager_lookup_class;
        public String hibernate_transaction_flush_before_completion;
        public String hibernate_transaction_auto_close_session;
        
        public String hibernate_current_session_context_class;
        public String hibernate_query_factory_class;
        public String hibernate_query_substitutions;
        public String hibernate_hbm2ddl_auto;
        public String hibernate_cglib_use_reflection_optimizer;
       
        
        hibernateConfig()
        {
           
        }
        
        
    }
    And here is the class it sits in; Everything else in this class serializes fine expect the hibernateConfig class.

    Java Code:
    import java.util.*;
     
    public class Database implements java.io.Serializable{
        
        private hibernateConfig config;
        private String name;
        private List   tables;
       
        
        public Database()
        {
            
        }
        public Database(String name)
        {
            this.name = name;
            tables    = new ArrayList();
            config    = new hibernateConfig();
        }
        
        public String getName()
        {
            return name;
        }
        
        public void setName(String name)
        {
            this.name = name;
        }
        
        public table getTable(int index)
        {
            return (table)tables.get(index);
        }
        
        public void addTable(table t)
        {
            this.tables.add(t);
        }
                
        public void removeTable(int index)
        {
            tables.remove(index);
        }
        
        public int numberOfTables()
        {
            return tables.size();
        }
        
        public void clearTables()
        {
            tables.clear();
        }
        
        public hibernateConfig getConfig()
        {
            return config;
        }
    }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    Where do you set the values of the variables in the hibernateConfig class?
    You don't show where you are writing the objects either.

    Do see that there is enough to go on from what you've posted.

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 02:12 AM
  2. Replies: 1
    Last Post: 07-22-2008, 04:27 PM
  3. Serializing Arrays
    By javaplus in forum New To Java
    Replies: 3
    Last Post: 11-08-2007, 09:09 AM
  4. How do I omit an object when serializing?
    By Hasan in forum Advanced Java
    Replies: 1
    Last Post: 05-31-2007, 04:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •