-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Error using dynamic-component with JPA
PostPosted: Fri Jul 08, 2011 10:34 am 
Newbie

Joined: Fri Jul 08, 2011 10:27 am
Posts: 1
Hi,

I'm having a problem using a dynamic-component mapping.

If I use hibernate directly, everything works fine. If I used through EntityManager, I get an exception when loading the configuration:

Exception in thread "main" java.lang.IllegalArgumentException: Cannot determine java-type from given member [null]

Any idea??? I can upload the full sample if needed.

thanks in advance

Tagut

pd: here is the full detail of configuration and clases.

=============================


I'm working with this versions:

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.5.Final</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.5.Final</version>
</dependency>


Exception in thread "main" java.lang.IllegalArgumentException: Cannot determine java-type from given member [null]
at org.hibernate.ejb.metamodel.AttributeFactory$BaseAttributeMetadata.<init>(AttributeFactory.java:608)
at org.hibernate.ejb.metamodel.AttributeFactory$SingularAttributeMetadataImpl.<init>(AttributeFactory.java:696)
at org.hibernate.ejb.metamodel.AttributeFactory$SingularAttributeMetadataImpl.<init>(AttributeFactory.java:686)
at org.hibernate.ejb.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:559)
at org.hibernate.ejb.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:93)
at org.hibernate.ejb.metamodel.AttributeFactory.getMetaModelType(AttributeFactory.java:225)
at org.hibernate.ejb.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:102)
at org.hibernate.ejb.metamodel.MetadataContext.wrapUp(MetadataContext.java:187)
at org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:66)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at test.Test.main(Test.java:24)

This is my mapping file:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="test">

<class name="TestEntity" table="TestEntity">
<id name="id" column="ID"/>
<dynamic-component name="mapa">
<property name="V_V1" column="V_V1" type="java.lang.String"/>
</dynamic-component>
<property name="status" column="STATUS"/>
</class>

</hibernate-mapping>

This is my configuration file:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
<property name="connection.username">OBPMENGINE</property>
<property name="connection.password">OBPMENGINE</property>

<property name="connection.pool_size">1</property>

<property name="dialect">org.hibernate.dialect.Oracle9iDialect</property>

<property name="current_session_context_class">thread</property>

<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>

<mapping resource="TestEntity.hbm.xml"/>

</session-factory>

</hibernate-configuration>

And this is my persistence file:

<persistence 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/ ... ce_2_0.xsd"
version="2.0">
<persistence-unit name="nt-bpm-bi" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>
<property name="hibernate.archive.autodetection" value="none"/>
</properties>
</persistence-unit>

</persistence>

======

This is my entity:


package test;

import java.util.Map;

public class TestEntity {
private Integer id;
private String status;
private Map mapa;

public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Map getMapa() {
return mapa;
}
public void setMapa(Map mapa) {
this.mapa = mapa;
}
}

And my test:

package test;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;


public class Test {

public static final void main(String args[]) throws Exception {


// This works fine.
// A SessionFactory is set up once for an application
// SessionFactory sessionFactory = new Configuration()
// .configure()
// .buildSessionFactory();
// Session s = sessionFactory.openSession();

// This fails.
EntityManagerFactory emf = Persistence.createEntityManagerFactory("nt-bpm-bi");
}

}


Top
 Profile  
 
 Post subject: Re: Error using dynamic-component with JPA
PostPosted: Tue Sep 06, 2011 4:14 am 
Newbie

Joined: Tue Sep 21, 2010 9:18 am
Posts: 3
Hi Tagut,

I am having exactly the same problem. Have you found any solution for this. I've tried it with the latest released version of Hibernate (3.6.7) but the issue still exists.

Thanks in advance,
Thomas


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.