Hello there,
I was trying to map a Map<String, Double> on a Pojo using the automatic creation of tables
Code:
@CollectionOfElements(fetch = FetchType.EAGER)
private Map<String, Double> curs = new HashMap<String, Double>();
On DB2, the generated DDL is
Code:
create table CursBNR_curs (CursBNR_id bigint not null, element double, mapkey varchar(255), primary key (CursBNR_id, mapkey))
which of course results in an error
Quote:
DB2 SQL Error: SQLCODE=-542, SQLSTATE=42831, SQLERRMC=MAPKEY, DRIVER=4.0.100
since the nullable column "mapkey" is not allowed to participate in a primary key definition.
I'm using the hibernate version which comes with JBoss 4.2.2.GA.
My persistence.xml looks like this
Code:
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="otpdms" transaction-type="JTA">
<jta-data-source>java:/icmnlsdbDS</jta-data-source>
<properties>
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.DB2Dialect" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JTATransactionFactory" />
<property name="jboss.entity.manager.jndi.name" value="java:entityManager" />
<property name="jboss.entity.manager.factory.jndi.name" value="java:entityManagerFactory" />
</properties>
</persistence-unit>
</persistence>
(Another issue is that the entity manager and entity manager factory do not get bound on the JNDI (I checked the JMX console), but that's another story)
Does anybody have the time and will to help me with that?
Thanx,
Eduard