What does "persist" really mean ?

Discussion in 'Java' started by Sébastien de Mapias, Jul 30, 2008.

  1. Hi,
    If I check Spring's doc of HibernateTemplate save(Object) method,
    it says that it "persists the given transient instance". What does
    this mean ??

    Thanks.
    SR
     
    Sébastien de Mapias, Jul 30, 2008
    #1
    1. Advertising

  2. Sébastien de Mapias

    Uwe Schmitt Guest

    On 30 Jul., 10:47, Sébastien de Mapias <> wrote:
    > Hi,
    > If I check Spring's doc of HibernateTemplate save(Object) method,
    > it says that it "persists the given transient instance". What does
    > this mean ??
    >
    > Thanks.
    > SR


    persisting an object means converting its state to a representation
    which will be saved to a db, filesystem, ...
    later on you can load the representation and reconstruct the object
    again.

    the task of converting an objects state is called 'serialization'.
    the representation can be in xml which is quite verbose, or in some
    other ascii or binary format.

    you can pass serialized objects through a network to some other
    machine, where it is reconstructed again.
    see http://java.sun.com/javase/technologies/core/basic/rmi/index.jsp

    greetings, uwe
     
    Uwe Schmitt, Jul 30, 2008
    #2
    1. Advertising

  3. Sébastien de Mapias wrote:
    > Hi,
    > If I check Spring's doc of HibernateTemplate save(Object) method,
    > it says that it "persists the given transient instance". What does
    > this mean ??
    >


    I usually interpret that as to write to disk or some other non-volatile
    medium which will retain the data if the Java program exits. Furthermore
    to do so in such a way that the Java application can read the data when
    it is restarted. I usually think in terms of persisting across a power
    shut-down, though I suppose the term could be used in the context of
    more volatile storage external to the application.

    In the case of Spring/Hibernate I bet in 99% of cases it means it will
    issue an SQL insert or update statement to a nearby DBMS.

    I imagine "transient instances" are instances of Java classes (i.e.
    objects) that are in peril if you pull the power cord out the back of
    the computer.

    Or have I misunderstood the question?

    --
    RGB
     
    RedGrittyBrick, Jul 30, 2008
    #3
  4. > In the case of Spring/Hibernate I bet in 99% of cases it means it will
    > issue an SQL insert or update statement to a nearby DBMS.


    OK in this case 'save()' does not really "persist" the object *yet*,
    until I commit, isn't it ? So the doc is rather unsufficient, am I
    mistaken ? (I'm dealing with a database indeed)

    To answer Eric Sosman: it's indeed the transitive usage of PERSIST
    that made me misunderstand its meaning here (and there are many
    other english words I'm not at ease with, because of their usage
    in informatics -"leverage" is an example...-).

    Thanks.
    Seb
     
    Sébastien de Mapias, Jul 30, 2008
    #4
  5. Sébastien de Mapias

    Tom Anderson Guest

    On Wed, 30 Jul 2008, Lew wrote:

    > Uwe Schmitt wrote:
    >> the task of converting an objects state is called 'serialization'.
    >> the representation can be in xml which is quite verbose, or in some

    >
    > But probably less verbose than java.io.Serializable serialization.


    Really? I'll run some tests ...

    >> other ascii or binary format.

    >
    > XML being "verbose" is one of those semi-true urban legends.


    My take on it is that it is true until you compress your stream, at which
    point it becomes very much not true.

    > "Verbose" compared to what?


    ASN.1.

    > And at what benefit?


    None.

    tom

    --
    10 PARTY : GOTO 10
     
    Tom Anderson, Jul 30, 2008
    #5
  6. Tom Anderson wrote:
    > On Wed, 30 Jul 2008, Lew wrote:
    >
    >> Uwe Schmitt wrote:
    >>> the task of converting an objects state is called 'serialization'.
    >>> the representation can be in xml which is quite verbose, or in
    >>> some

    >>
    >> But probably less verbose than java.io.Serializable serialization.

    >
    > Really? I'll run some tests ...


    Try comparing the Swing Archiver to serialization. Brcause the former
    only stores properties that have non-default values, where
    serialization stores every single non-transient field, it can result
    in much smaller persistent formats.
     
    Mike Schilling, Jul 30, 2008
    #6
  7. Sébastien de Mapias

    Lew Guest

    Lew asked:
    > > "Verbose" compared to what?


    Tom Anderson wrote:
    > ASN.1.


    Lew:
    > > And at what benefit?


    Tom:
    > None.


    XML has many benefits as an serialization format, not least that it is
    semantically void. It is also human-readable. I am not familiar with
    ASN.1, which may have similar advantages.

    XML is also infinitely extensible and self-describing. The verbosity
    buys something.

    --
    Lew
     
    Lew, Jul 30, 2008
    #7
  8. Sébastien de Mapias

    Stefan Ram Guest

    Sébastien de Mapias <> writes:
    >If I check Spring's doc of HibernateTemplate save(Object) method,
    >it says that it "persists the given transient instance". What does
    >this mean ??


    It means to save.
    ¯¯¯¯
    This might be an example, where the method name says more
    than the documentation.

    Which reminds me of a note, where someone recently wrote
    »When I get a piece of code I need to understand, the first
    thing I do is to strip all commments.«
     
    Stefan Ram, Jul 30, 2008
    #8
  9. Sébastien de Mapias

    Roedy Green Guest

    On Wed, 30 Jul 2008 01:47:57 -0700 (PDT), Sébastien de Mapias
    <> wrote, quoted or indirectly quoted someone who
    said :

    >If I check Spring's doc of HibernateTemplate save(Object) method,
    >it says that it "persists the given transient instance". What does
    >this mean ??


    see http://mindprod.com/jgloss/persistence.html
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Jul 31, 2008
    #9
  10. Sébastien de Mapias

    Tom Anderson Guest

    On Wed, 30 Jul 2008, Lew wrote:

    > Lew asked:
    >>> "Verbose" compared to what?

    >
    > Tom Anderson wrote:
    >> ASN.1.

    >
    > Lew:
    >>> And at what benefit?

    >
    > Tom:
    >> None.

    >
    > XML has many benefits as an serialization format, not least that it is
    > semantically void.


    "Semantically void"?

    > It is also human-readable. I am not familiar with ASN.1, which may have
    > similar advantages.


    Well, it's certainly not human-readable [1]. Nor, sadly, is its
    specification!

    > XML is also infinitely extensible and self-describing. The verbosity
    > buys something.


    ASN.1 has the same degree of self-describingness as XML. The two are
    really very similar when you get down to it. Indeed, there is a degree of
    interoperability:

    http://asn1.elibel.tm.fr/xml/

    tom

    [1] Kinda. ASN.1 is actually not an encoding, but a sort of framework for
    encoding, within which there are a few specific encodings. The standard
    one is the Basic Encoding Rules, BER, which is binary, fairly compact, and
    self-describing. There's also the Packed Encoding Rules, PER, which is
    maximally compact, but not self-describing. I think there are also
    human-readable formats (there's certainly an XML one), but that's not
    usually what people mean when they say ASN.1.

    --
    roger and kay payne, symmetry, piercing, archaeology, position, in ,,
     
    Tom Anderson, Jul 31, 2008
    #10
  11. Sébastien de Mapias

    Tom Anderson Guest

    On Thu, 31 Jul 2008, Lew wrote:

    > Lew wrote:
    >>> XML has many benefits as an serialization format, not least that it is
    >>> semantically void.

    >
    > Tom Anderson wrote:
    >> "Semantically void"?

    >
    > XML formats do not depend on nor impinge on the meaning of the content.
    > Put another way, XML (like ASN.1 from what you've told us) is
    > self-describing, so one need not refer to an external source to
    > interpret the contents.


    Right, got it.

    > The meaning is entirely at the endpoints of an XML document's use, not
    > internal to the document. With other formats, for example positional
    > layouts where a field belongs to a certain position on a line, the
    > semantics are part of the format.


    Yes. XML is more of a format architecture than a format per se, and it's
    the formats you define with XML that impose meaning.

    Although one could argue that XML does impose some meaning, in that it's
    hierarchical: it doesn't have a natural way to describe directed acyclic
    graphs, or matrices. The ID/IDREF mechanism does give you quite a good way
    to do DAGs, but it's not quite as natural as the way XML deals with
    hierarchies.

    tom

    --
    Faith in chaos.
     
    Tom Anderson, Aug 1, 2008
    #11
  12. Sébastien de Mapias

    Arne Vajhøj Guest

    Sébastien de Mapias wrote:
    >> In the case of Spring/Hibernate I bet in 99% of cases it means it will
    >> issue an SQL insert or update statement to a nearby DBMS.

    >
    > OK in this case 'save()' does not really "persist" the object *yet*,
    > until I commit, isn't it ?


    Now you really need a precise definition of persist.

    Save will send the data to the database. And it may be seen
    by other processes if the transaction isolation level is low.
    But until commit is called then the data can still be told to
    go away.

    I will tend to agree with you: data is first persisted when they are
    committed.

    Arne
     
    Arne Vajhøj, Aug 2, 2008
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Dean
    Replies:
    5
    Views:
    1,241
    Hans Nowak
    Sep 9, 2003
  2. Steven T. Hatton

    What does "formatted" I/O really mean?

    Steven T. Hatton, Aug 1, 2005, in forum: C++
    Replies:
    2
    Views:
    361
    Dietmar Kuehl
    Aug 1, 2005
  3. Casey
    Replies:
    9
    Views:
    271
    Robert Kern
    Oct 4, 2007
  4. Sébastien de Mapias

    Does "persist" mean *commit* ??

    Sébastien de Mapias, Jul 31, 2008, in forum: Java
    Replies:
    2
    Views:
    588
    Roedy Green
    Jul 31, 2008
  5. C Barrington-Leigh
    Replies:
    1
    Views:
    1,263
    Tim Leslie
    Sep 10, 2010
Loading...

Share This Page