移動數據庫引擎Realm Java v2.0.0 發布
Realm 是一個跨平臺的移動數據庫引擎,可運行于手機、平板和可穿戴設備之上。于 2014 年 7 月發布,準確來說,它是專門為移動應用所設計的數據持久化解決方案之一。 Realm 可以輕松地移植到您的項目當中,并且絕大部分常用的功能(比如說插入、查詢等等)都可以用一行簡單的代碼輕松完成! Realm 并不是對 Core Data 的簡單封裝,相反地, Realm 并不是基于 Core Data ,也不是基于 SQLite 所構建的。它擁有自己的數據庫存儲引擎,可以高效且快速地完成數據庫的構建操作。
更新日志
重大更改
- Files written by Realm 2.0 cannot be read by 1.x or earlier versions. Old files can still be opened.
- It is now required to call
Realm.init(Context)
before calling any other Realm API. - Removed
RealmConfiguration.Builder(Context)
,RealmConfiguration.Builder(Context, File)
andRealmConfiguration.Builder(File)
constructors. isValid()
now always returnstrue
instead offalse
for unmanagedRealmObject
andRealmList
. This puts it in line with the behaviour of the Cocoa and .NET API's (#3101).- armeabi is not supported anymore.
- Added new
RealmFileException
.IncompatibleLockFileException
has been removed and replaced byRealmFileException
with kindINCOMPATIBLE_LOCK_FILE
.RealmIOExcpetion
has been removed and replaced byRealmFileException
.
RealmConfiguration.Builder.assetFile(Context, String)
has been renamed toRealmConfiguration.Builder.assetFile(String)
.- Object with primary key is now required to define it when the object is created. This means that
Realm.createObject(Class<E>)
andDynamicRealm.createObject(String)
now throwsRealmException
if they are used to create an object with a primary key field. UseRealm.createObject(Class<E>, Object)
orDynamicRealm.createObject(String, Object)
instead. - Importing from JSON without the primary key field defined in the JSON object now throws
IllegalArgumentException
. - Now
Realm.beginTransaction()
,Realm.executeTransaction()
andRealm.waitForChange()
throwRealmMigrationNeededException
if a remote process introduces incompatible schema changes (#3409). - The primary key value of an object can no longer be changed after the object was created. Instead a new object must be created and all fields copied over.
- Now
Realm.createObject(Class)
andRealm.createObject(Class,Object)
take the values from the model's fields and default constructor. Creating objects through theDynamicRealm
does not use these values (#777). - When
Realm.create*FromJson()
s create a newRealmObject
, now they take the default values defined by the field itself and its default constructor for those fields that are not defined in the JSON object.
增強功能
- Added
realmObject.isManaged()
,RealmObject.isManaged(obj)
andRealmCollection.isManaged()
(#3101). - Added
RealmConfiguration.Builder.directory(File)
. RealmLog
has been moved to the public API. It is now possible to control which events Realm emit to Logcat. See theRealmLog
class for more details.- Typed
RealmObject
s can now continue to access their fields properly even though the schema was changed while the Realm was open (#3409). - A
RealmMigrationNeededException
will be thrown with a cause to show the detailed message when a migration is needed and the migration block is not in theRealmConfiguration
.
Bug 修復
- Fixed a lint error in proxy classes when the 'minSdkVersion' of user's project is smaller than 11 (#3356).
- Fixed a potential crash when there were lots of async queries waiting in the queue.
- Fixed a bug causing the Realm Transformer to not transform field access in the model's constructors (#3361).
- Fixed a bug causing a build failure when the Realm Transformer adds accessors to a model class that was already transformed in other project (#3469).
- Fixed a bug causing the
NullPointerException
when calling getters/setters in the model's constructors (#2536).
內部
- Moved JNI build to CMake.
- Updated Realm Core to 2.0.0.
- Updated ReLinker to 1.2.2.
下載
本站原創,轉載時保留以下信息:
本文轉自:深度開源(open-open.com)
原文地址:http://www.baiduhome.net/news/view/c200ff2
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!