Monthly Archives: June 2010

Android中一些关于sqlite的总结-1

1.数据库文件 位于:/data/data/{package} /databases文件夹中 2.SQLiteOpenHelper 的onCreate,onUpgrade  你可以扩展SQLiteOpenHelper类,它是一个Android辅助类,主要用于数据库创建和版本管理。实际上,你可以覆盖onCreate()和onUpgrade()方法 onCreate在数据库第一次被创建的时候才会调用,不用担心每次都掉用。 因为很多例子都是create table的语句,重复调用显然原来的数据会没的。 而onUpgrade则是升级的时候才会调用,看如下代码: @Override         public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {             Log.w(TAG, "Upgrading database from version " + oldVersion + " to

Posted in Android, Tech

hibernate3.2里的Transformers

hibernate 里想将sql的结果转为对象,但是对象不想再.hb.xml里定义,可以考虑用 ResultTransformer 使用SQL Transformers List resultWithAliasedBean = s.createSQLQuery(   "SELECT st.name as studentName, co.description as courseDescription " +   "FROM Enrolment e " +   "INNER JOIN Student st on e.studentId=st.studentId " +   "INNER JOIN Course co on

Posted in Tech Tagged with:

找不到org.slf4j.impl.StaticLoggerBinder

启动tomcat出错: 严重: Servlet /AppStoreServer threw load() exception java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)     at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:223)     at org.slf4j.LoggerFactory.bind(LoggerFactory.java:120)     at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)     at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:255) 原来hibernate自带了个slf4j的东西,但是不带这个,还要另外下载。

Posted in Tech

hibernate的mappingResources和mappingDirectoryLocations

如果嫌mappingResources的麻烦,可以用mappingDirectoryLocations <property name="mappingDirectoryLocations">         <list>      <value>WEB-INF/rescources/com/abc</value>         </list>  </property>

Posted in Tech Tagged with: , , , , ,

hibernate-extensions和hiberanate版本的问题

想用hbm2java生成java代码,却出现错误: Exception in thread “main” java.lang.NoClassDefFoundError: net/sf/hibernate/MappingException Caused by: java.lang.ClassNotFoundException: net.sf.hibernate.MappingException 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) Could not find the main class: net.sf.hibernate.tool.hbm2java.CodeGenerator. Program will exit. 查了一下,原来这个MappingException在最新的hibernate里面没有了(3.5.3Final),还要在老的版本里去找。

Posted in Tech Tagged with: , , , , , , ,

Unparsed aapt error(s)! Check the console for output

clean一下project就可以了

Posted in Android Tagged with: , ,

无觅相关文章插件,快速提升流量