在创建entity的时候要注意entity的名字是否是对应的db的保留字 现在的开发中用到了lock这个entity,在persistence的时候出现错误: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Lock (lockOwner_UU ID, version_UUID, UUID) values (‘ff808181211ae76901211ae76c2c0′ at line 1 因为lock是mysql的保留字。 mysql的所有保留字可以在下面的网页里查到 http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
Posts tagged jpa
Strange clash @Transactional @Autowired – Spring Community Forums
You aren’t programming to interfaces, but directly to classes. As your super class does implement an interface spring create a JDK dynamic proxy which will be of the BaseDao NOT AnyDao. To solve you issue either follow the best practice of programm to interfaces (i.e. make AnyDao an interface and AnyDaoImpl the implementtion) or enable [...]
JPA持久化List
List, List等类型不能直接用one-to-many够持久. 因为这些类型没有id. 为了持久话这些类型,需要把String或者是URL包装一下 例如下面的例子: [code lang="java"] @Entity public class RURL { String uuid; URL url; @Id @Column(nullable = false, updatable = false, length = 32) @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid") public String getUUID() { return uuid; } public void setUUID(String uuid) { this.uuid = uuid; } public URL getURL() { [...]
Spring2.5 中自动注入bean
下面是配置文件,其中要注意的是要把context的namespace和schemaLocation加到beans的属性里,schemaLocation的顺序也很重要,必须是: http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd 之后在java的类里加入 @Autowired 就可以自动地把配置文件中类型合适的bean注入进来。 [code lang="java"] @Autowired private ExeBPELVersionDaoImpl edao; [/code] [code lang="xml"] [/code]