released version 4.26

99 views
Skip to first unread message

Gray Watson

unread,
Sep 26, 2011, 10:40:17 AM9/26/11
to ormlit...@googlegroups.com, ormlite-android, ormli...@googlegroups.com
Large-ish release with some bug files and features. Biggest changes in this release are the initial support for an object cache and the improvements around Android type configuration for startup optimization.

* CORE: Added the first take on a object cache. Thanks to the dev list for suggestions.
* CORE: Improved the javax.persistence annotation handling to support @JoinColumn(name="xxx"). Thanks to Andrew Sleeman.
* CORE: Added a RuntimeExceptionDao for wrapping Dao operations in RuntimeExceptions. Thanks to the Android list.
* CORE: Added a Dao.deleteById() method for removing an instance if you just have the id.
* CORE: Added @DatabaseField(columnDefiniton = "...") for hand-defining the field SQL.
* CORE: Removed the deprecated RawResults class that was replaced in 4.10.
* CORE: Fixed problem with self-generated id fields not being marked as primary. Thanks to Craig Andrews. Fixes bug #3406600.
* CORE: Fixed a problem where default was canBeNull=false with javax persistence macros. Thanks to A. Fixes bug #3410640.
* CORE: Removed the maxForeignLevel() field from @DatabaseField which was deprecated in 4.22.
* CORE: Added table and field configuration file reading and writing.
* ANDROID: Added field configuration utility for avoiding Dao creation performance problems with annotations. Thanks to Ian Dees.
* ANDROID: Added @DatabaseFieldSimple and other smaller annotations for speeding up Android configuration.
* ANDROID: Added SQLiteDatabase constructor to AndroidConnectionSource for external SQLite databases. Thanks to Michael.
* ANDROID: Removed the SqliteOpenHelperFactory class that was deprecated in 4.20.
* ANDROID: Fixed issue that was not properly supporting CREATE IF NOT EXISTS. Thanks to birbird. Fixes bug #3412135.
* ANDROID: Added RuntimeExceptionDao for shielding applications from _some_ of the SQLException handling.

You can get the release via ORMLite:

http://ormlite.com/releases/

or via Maven once the sync finishes:

http://repo1.maven.org/maven2/com/j256/ormlite/

Or from sourceforge.net. Feedback always welcome.
gray

Ming Q. Lin

unread,
Sep 26, 2011, 12:06:43 PM9/26/11
to ormlite...@googlegroups.com
Thanks for great ORM for Android!

Regarding " Added field configuration utility for avoiding Dao creation performance problems with annotations.  Thanks to Ian Dees." are there anything Developer need to do special in order to setup Android Eclipse project?

Gray Watson

unread,
Sep 26, 2011, 12:19:21 PM9/26/11
to ormlite...@googlegroups.com
On Sep 26, 2011, at 12:06 PM, Ming Q. Lin wrote:

> Regarding " Added field configuration utility for avoiding Dao creation performance problems with annotations."

> are there anything Developer need to do special in order to setup Android Eclipse project?

Excellent question that I should have addressed in my followup mail to 4.26. There is some documentation on how to get it to work. It's not as easy as it should be.

http://ormlite.com/docs/table-config

The big caveat is that it is right now a _manual_ process. There have been some discussions around maven and ant integration.

Feedback on the documentation is welcome.
gray

Craig Andrews

unread,
Sep 26, 2011, 12:25:20 PM9/26/11
to ormlite...@googlegroups.com

Here's how I'm doing it:
1.) In .gitignore (or however you ignore a file in the VCS you're using),
ignore res/raw/ormlite_config.txt.
2.) In ant's build.xml, add these targets:
<target name="-pre-build">
<!--res/raw probably doesn't exist yet, so make it-->
<mkdir dir="res/raw" />
<!--file is ignored in source control, but required during build. So
create a blank file, then in a later phase,
before the apk is made, the real file will be created-->
<touch file="res/raw/ormlite_config.txt" />
</target>
<target name="-post-compile" depends="ormlite">
</target>
<target name="ormlite">
<java fork="false" failonerror="yes"
classname="com.j256.ormlite.android.apptools.OrmLiteConfigUtil">
<classpath>
<fileset dir="${jar.libs.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${out.classes.dir}"/>

<path refid="android.target.classpath"/>
</classpath>
<arg value="ormlite_config.txt"/>
</java>
</target>

That should do it. The ormlite_config.txt is not included in source
control (having in source control is incredibly annoying, as it changes
for literally every build due to a timestamp at the top of it) and
automatically without thought regenerated for each compile.

~Craig

Ming Q. Lin

unread,
Sep 29, 2011, 11:45:46 AM9/29/11
to ormlite...@googlegroups.com
I try to follow the steps to run the tool, but get following error. please let me know if you need more detail.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:3494), pid=2464, tid=1980
#  Error: ShouldNotReachHere()
#
# JRE version: 6.0_26-b03
# Java VM: Java HotSpot(TM) Client VM (20.1-b02 mixed mode windows-x86 )
# An error report file with more information is saved as:
# E:\AppYet\trunk\com.appyet.mobile\hs_err_pid2464.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

Ming Q. Lin

unread,
Sep 29, 2011, 12:51:50 PM9/29/11
to ormlite...@googlegroups.com
I have fixed the fatal error below, after remove the default bootstrap value from ClassPath. But receive following new exception:

Writing configurations to E:\AppYet\trunk\com.appyet.mobile.client\.\res\raw\ormlite_config.txt
Exception in thread "main" java.lang.NoClassDefFoundError: android/os/IInterface
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.j256.ormlite.android.apptools.OrmLiteConfigUtil.findAnnotatedClasses(OrmLiteConfigUtil.java:207)
    at com.j256.ormlite.android.apptools.OrmLiteConfigUtil.findAnnotatedClasses(OrmLiteConfigUtil.java:188)
    at com.j256.ormlite.android.apptools.OrmLiteConfigUtil.findAnnotatedClasses(OrmLiteConfigUtil.java:188)
    at com.j256.ormlite.android.apptools.OrmLiteConfigUtil.findAnnotatedClasses(OrmLiteConfigUtil.java:188)
    at com.j256.ormlite.android.apptools.OrmLiteConfigUtil.findAnnotatedClasses(OrmLiteConfigUtil.java:188)
    at com.j256.ormlite.android.apptools.OrmLiteConfigUtil.findAnnotatedClasses(OrmLiteConfigUtil.java:188)
    at com.j256.ormlite.android.apptools.OrmLiteConfigUtil.writeConfigFile(OrmLiteConfigUtil.java:113)
    at com.j256.ormlite.android.apptools.OrmLiteConfigUtil.writeConfigFile(OrmLiteConfigUtil.java:101)
    at com.appyet.mobile.data.DatabaseConfigUtil.main(DatabaseConfigUtil.java:7)
Caused by: java.lang.ClassNotFoundException: android.os.IInterface
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 23 more

Gray Watson

unread,
Sep 29, 2011, 2:59:33 PM9/29/11
to ormlite...@googlegroups.com
So I worked on this a bit. Turns out that Class.forName() throws an Error in certain circumstances.

Here's a new version of the OrmLiteConfigUtil.java that I just checked into trunk. This seems to work better although it still feels like a kludge.

This was a problem with the class auto-discovery. Remember is that you can also configure a certain array of classes:

public class DatabaseConfigUtil extends OrmLiteConfigUtil {
private static final Class<?>[] classes = new Class[] {
SimpleData.class,
};
public static void main(String[] args) throws Exception {
writeConfigFile("ormlite_config.txt", classes);
}
}

See the docs: http://ormlite.com/docs/table-config

gray

Gray Watson

unread,
Sep 29, 2011, 3:00:39 PM9/29/11
to ormlite...@googlegroups.com
This time with the attachment. :-)
gray

OrmLiteConfigUtil.java
Reply all
Reply to author
Forward
0 new messages