4

Which of the following is correct?

  1. The program persists the data in the database.
  2. The program persists the data to the database.

In feels a little more natural to me, but I have no particular basis for that.

3
  • 2
    Today I learned that persist can be transitive. Interesting. (In probably sounds more natural because that's what you'd normally use with the intransitive verb, as in "I persist in my view". You wouldn't say "I persist to my view".)
    – RegDwigнt
    Nov 17, 2010 at 13:21
  • what is transitive and why would you normally use in with the transitive verb? Nov 17, 2010 at 13:28
  • @vehomzzz: a transitive verb is one which acts on something (technically, it has an object). See en.wikipedia.org/wiki/Transitive_verb - or ask that as a question on this site! Nov 17, 2010 at 13:38

3 Answers 3

1

The program persists the data in the database.

Here is what I would say in general:

  • save the object in the database
  • update the object in the database
  • persist the object in the database (same as save or update)
  • load the object from the database
  • write the object to a file
  • read the object from a file
3

Despite RegDwight's comment that persist can be transitive with a direct object, which I didn't know either, I'd suggest that such usage is unusual.

With regard to the actual question, the use of persist suggests that the data was in the database before, and that the program doesn't change that; hence in should be used here.

So I would write:

The program causes the data to persist in the database.

EDIT: In light of the comments below, note this answer applies to persist in its normal, non-programming, contexts. For its use in a programming context, in is still correct, but the verb can be used transitively, as in the question.

6
  • Yeah, Merriam-Webster and Co. don't list it as transitive, but Wiktionary actually does, hence my comment.
    – RegDwigнt
    Nov 17, 2010 at 13:35
  • @RegDwight: given that the example quoted is quite recent, I wonder if this usage is a new one which hasn't caught on (yet). Nov 17, 2010 at 13:41
  • 2
    @Steve, @RegDwight: it can be transitive because you can say "persist an object" the same way that you can say "save/load/update/merge an object". It's a technical definition of persist that is particular to programming. Apparently, most dictionaries don't bring that definition of "persist" yet.
    – b.roth
    Nov 17, 2010 at 13:53
  • 1
    @RegDwight: Just a note on usage, persist here does not imply that the data was already there. In fact I'd go as far as saying that usually it is not already present. Persisting is the action of saving the data, I suppose. Nov 17, 2010 at 14:29
  • 1
    Well, you learn something new every day :-) Nov 17, 2010 at 14:35
2

I would have choosen both. I mean "Into" :-)

1
  • as the database is a container, you place things into it to persist them.
    – Dan D.
    Feb 15, 2011 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.