• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mapping exception when building session factory for as400 database

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
In my code I am trying to build a session factory from a Configuration object like so...

Configuration as400configuration = new Configuration();

as400configuration.configure("/hibernate-as400.cfg.xml");
as400SessionFactory = as400configuration.buildSessionFactory();

For some reason the buildSessionFactory method throws the following exception....

[STDERR] org.hibernate.MappingException: Could not determine type for: com.hfa.common.persistence.hibernate.PasswordDataType, for columns: [org.hibernate.mapping.Column(PASSWORD)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)

Here is the content of my hibernate configuration file....

<property name="connection.driver_class">com.ibm.as400.access.AS400JDBCDriver</property>
<property name="connection.url">jdbc:as400://10.2.3.7</property>
<property name="connection.username">ARCH2004</property>
<property name="connection.password">ARCHTEAM</property>
<property name="connection.pool_size">1</property>
<property name="default_schema">DATA</property>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="show_sql">false</property>

This is an as400 database.

Any idea what could be causing this exception? It might have something to do with this "com.hfa.common.persistence.hibernate.PasswordDataType" class but I am not using this anywhere in my code.

Thanks in advance for any help.

[ June 05, 2008: Message edited by: Jehan Jaleel ]
[ June 05, 2008: Message edited by: Jehan Jaleel ]
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you mapping to an already existing database? I have a feeling the database may be using a special character type to perhaps encrypt the password. In your code, you're doing a simple mapping, and Hibernate is having a problem reconciling this database type with the "Simple" type to which it is defaulting.

-Cameron McKenzie
 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cameron,
Thanks for the reply. If that is the case then can you tell me how I can change my configuration so that it is no longer doing a simple mapping?

Thanks,
Jehan
 
Mart Thorpe
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. We are facing something similar. Did you every get a solution to this? Did you find a way to make the mapping of encrypted type instead of simple?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic