JPAうまくいかないです。><

ヘタレだなぁ・・・
正直こんなに はまるとは思わなかったです・・・。

 

@ManyToOne
@JoinColumn(name = "deptno")
private Department department;
 →これじゃなぜか無反応で設定したことになっていない。

@ManyToOne
@JoinColumn(name = "deptno")
public Department getDepartment() {
	return this.department;
}
 →JoinColumnをつけるとOGNLエラーになります。

org.seasar.framework.exception.OgnlRuntimeException: [ESSR0073]OGNLで例外が発生しました。理由はognl.MethodFailedException: Method "createEntityManagerFactory" failed for object class javax.persistence.Persistence [javax.persistence.PersistenceException: org.hibernate.MappingException: Repeated column in mapping for entity: examples.jsf.entityjpa.Employee column: deptno (should be mapped with insert="false" update="false")]
	at org.seasar.framework.util.OgnlUtil.getValue(OgnlUtil.java:42)
	at org.seasar.framework.container.assembler.AbstractConstructorAssembler.assembleExpression(AbstractConstructorAssembler.java:62)
	at org.seasar.framework.container.assembler.AbstractConstructorAssembler.assemble(AbstractConstructorAssembler.java:45)
	at org.seasar.framework.container.deployer.SingletonComponentDeployer.assemble(SingletonComponentDeployer.java:67)
	at org.seasar.framework.container.deployer.SingletonComponentDeployer.deploy(SingletonComponentDeployer.java:51)
	at org.seasar.framework.container.deployer.SingletonComponentDeployer.init(SingletonComponentDeployer.java:96)
	at org.seasar.framework.container.impl.ComponentDefImpl.init(ComponentDefImpl.java:283)
	at org.seasar.framework.container.impl.S2ContainerImpl.init(S2ContainerImpl.java:361)
	at org.seasar.framework.container.impl.S2ContainerImpl.init(S2ContainerImpl.java:358)
	at org.seasar.framework.unit.S2FrameworkTestCase.runBare(S2FrameworkTestCase.java:132)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: ognl.MethodFailedException: Method "createEntityManagerFactory" failed for object class javax.persistence.Persistence [javax.persistence.PersistenceException: org.hibernate.MappingException: Repeated column in mapping for entity: examples.jsf.entityjpa.Employee column: deptno (should be mapped with insert="false" update="false")]
	at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:796)
	at ognl.ObjectMethodAccessor.callStaticMethod(ObjectMethodAccessor.java:48)
	at ognl.OgnlRuntime.callStaticMethod(OgnlRuntime.java:806)
	at ognl.ASTStaticMethod.getValueBody(ASTStaticMethod.java:67)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:171)
	at ognl.SimpleNode.getValue(SimpleNode.java:213)
	at ognl.Ognl.getValue(Ognl.java:333)
	at ognl.Ognl.getValue(Ognl.java:310)
	at org.seasar.framework.util.OgnlUtil.getValue(OgnlUtil.java:40)
	... 18 more


あと、junit起動時にFATALエラーが出るのはなにか根本的に設定が間違っているんだろうか?
でもHibernate-JPA EA2をダウンロードした設定のままだと思うのになぁ。
なにかいじったかな・・

2006-05-04 18:52:55,453 [main] INFO  org.hibernate.cfg.Environment - Hibernate 3.1.1
2006-05-04 18:52:55,463 [main] INFO  org.hibernate.cfg.Environment - hibernate.properties not found
2006-05-04 18:52:55,473 [main] INFO  org.hibernate.cfg.Environment - using CGLIB reflection optimizer
2006-05-04 18:52:55,473 [main] INFO  org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
2006-05-04 18:52:56,214 [main] FATAL org.hibernate.ejb.packaging.PersistenceXmlLoader - em JTA