一、DatabaseGenerateException
可能会在生成表或者更新表的时候抛出。列出常见异常:
- can not find a class named
- An exception that indicates there was an error with SQL parsing or execution.
- SQL syntax error happens while executing
- Table doesn't exist when executing
- Table doesn't exist with the name of
二、DataSupportException
可能会在GRUD操作的时候抛出。列出常见异常:
- id type is not supported. Only int or long is acceptable for id
- should be inherited from DataSupport
- The field to declare many2one or many2many associations should be List or Set.
- Save current model failed.
- needs a default constructor.
- The parameters in conditions are incorrect.
三、GlobalException
全局异常。没有继承LitePalApplication,或者在自定义Application中调用initialize方法。
Application context is null. Maybe you haven't configured your application name with \"org.litepal.LitePalApplication\" in your
AndroidManifest.xml. Or you can call LitePalApplication.initialize(Context) method instead.
四、InvalidAttributesException
非法属性引发的异常,列出常见异常:
- dbname is empty or not defined in litepal.xml file
- the version of database can not be less than 1
- the version in litepal.xml is earlier than the current version
- is an invalid value for <cases></cases>
五、ParseConfigurationFileException
LitePal默认使用SAX解析xml文件,所以解析异常有可能会抛出:
- litepal.xml file is missing. Please ensure it under assets folder.
- can not parse the litepal.xml, check if it's in correct format
- parse configuration is failed
- IO exception happened