zoukankan      html  css  js  c++  java
  • core data 与 hibernate

    Core DataMac OS XCocoa API的一部分,首次在Mac OS X 10.4 TigeriOS 3.0系统中出现[2]。它允许按照实体-属性-值模型组织数据,并以XML二进制文件SQLite数据文件的格式将其串行化。Core Data允许用户使用代表实体和实体间关系的高层对象来操作数据。它也可以管理串行化的数据,提供对象生存期管理与object graph管理,包括存储。Core Data直接与SQLite交互,避免开发者使用原本的SQL语句[3]

    就像Cocoa绑定模型-视图-控制器设计中做了很多控制器的工作一样,Core Data做了很多数据模型的工作。它的主要任务是负责数据更改的管理,串行化到磁盘,最小化内存占用,以及查询数据。

    object-relational mapper (ORM) hibernate也是 orm框架,

    Core Data isn't so much a database engine as it is an API that abstracts over the actual data store. You can tell Core Data to save as an sqlite database, a plist, a binary file, or even a custom data store type.

    I would recommend learning Core Data, as is it an excellent resource that greatly accelerates many parts of cocoa application development.

    要不要用 core data,

    Prior to the release of OS 3.0 on the iPhone, SQLite was the choice for database implementation on the iPhone.  Since the addition of core data to the iPhone SDK, using SQLite with low level C function calls is no longer the only option, and now a question often asked is about which to use.

    First, let’s take a look at using SQLite directly.

    - Relational Database System
    - Potential for cross platform compatibility
    - Many early iPhone database examples were written using SQLite
    - Objective-C wrappers such as FMDB are pretty easy to use

    Now at Core Data:

    - Can store data in it’s own Binary, or SQLite storage format.
    - Can serialize objects
    - Much higher level than using SQLite directly
    - Not a RDBMS you could actually just store things directly.

    Now the real question is, which is easier to use?  Well, that really depends on what you’re doing.  In an app I recently created all I had to do was read small amounts of data sequentially from a SQLite database, since this is such a simple task I simply used FMDB along with iPhone SQLite.  Now, if I needed to do anything with the data beyond reading it, Core Data can make all this much easier, and I’d recommend using it.

    Conclusion: Core Data just makes so many things so much easier that I would recommend using it unless you already have existing code, or are doing only the most basic database usage.

  • 相关阅读:
    map
    01背包和完全背包 POJ
    并查集 计算节点数量
    set
    map,vector,queue 图 综合运用
    并查集 hdu-1325 Is It A Tree?
    js中的ajax
    java算法
    MySql在Window上的安装
    微信开发账号要求
  • 原文地址:https://www.cnblogs.com/guligei/p/3478799.html
Copyright © 2011-2022 走看看