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.

  • 相关阅读:
    python模块总结(一)命令行解析模块argparse
    TCP(一)三次握手和四次挥手
    容器网络(四)vxlan
    容器网络(三)容器间通信
    kvm虚拟化(二)网络虚拟化
    KVM虚拟化(一)创建虚拟机
    数字操作 —— 9_ 回文数
    数字操作 —— 8_字符串转换整数(atoi)
    数字操作 —— 7_整数反转
    字符串操作 —— 763_划分字母区间
  • 原文地址:https://www.cnblogs.com/guligei/p/3478799.html
Copyright © 2011-2022 走看看