• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Can I serialize a java object to Varchar field in a database

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can I serialize a java object to Varchar field in a database?
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'd better choose a binary field (blob).
But the most common way to serialize an object is defining
a field in your table for each atribute of your class.


For example:

class Person{
private int id;
private String name;
// getters and setters
}

In your database:

CREATE TABLE Person(
id int not null primary key,
name varchar(50) NOT NULL );

You can use Hibernate in your application to do all the mappings and persist
your objects.
reply
    Bookmark Topic Watch Topic
  • New Topic