Re: [Teneo] Need ClassMetadata but it's not present [message #687421] |
Wed, 08 June 2011 22:06 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Mike,
Now I am confused :-), this (see below) is the signature of the 2 getClassMetaData methods in the Hibernate
SessionFactory interface, they both take a parameter. Or do you mean another object (than SessionFactory)?
Teneo generates a hbm mapping in-memory and maps using the entity name (eclass name mostly). Teneo adds different kinds
of mapping information to make sure that different EMF constructs work correctly, so it not possible to directly add EMF
generated classes to the configuration object (this is different with Texo).
/**
* Retrieve the {@link ClassMetadata} associated with the given entity class.
*
* @param entityClass The entity class
*
* @return The metadata associated with the given entity; may be null if no such
* entity was mapped.
*
* @throws HibernateException Generally null is returned instead of throwing.
*/
public ClassMetadata getClassMetadata(Class entityClass);
/**
* Retrieve the {@link ClassMetadata} associated with the given entity class.
*
* @param entityName The entity class
*
* @return The metadata associated with the given entity; may be null if no such
* entity was mapped.
*
* @throws HibernateException Generally null is returned instead of throwing.
* @since 3.0
*/
public ClassMetadata getClassMetadata(String entityName);
On 06/08/2011 06:08 PM, forums-noreply@eclipse.org wrote:
> Hi Martin,
>
> Many thanks for the info!
> I'm a bit confused when you say the parameter passed to getClassMetadata() since that method takes no arguments. When I
> look at the HbnContainer examples it appears that the Class is being configured with AnnotationConfiguration like this:
>
>
> AnnotationConfiguration cnf = new AnnotationConfiguration();
> <...delete other config...>
> cnf.addAnnotatedClass(Workout.class);
> cnf.addAnnotatedClass(Type.class);
> sessionFactory = cnf.buildSessionFactory();
>
> In this case Workout and Type are the classes. You can do something similar with Configuration class as well. I'm
> assuming the addAnnotatedClass method is what tells hibernate's SessionFactory what class to return in getClassMetadata,
> but I'm not sure of this.
>
> Is there some means of doing the above with Teneo? i.e. Pass along a Configuration instance which has my model class set
> via setClass or setAnnotatedClass?
>
> Best regards,
> mike
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.02692 seconds