-->
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.  [ 4 posts ] 
Author Message
 Post subject: Skip the field in the bean from mapping to database
PostPosted: Wed Dec 12, 2007 3:31 pm 
Newbie

Joined: Wed Dec 12, 2007 3:04 pm
Posts: 9
I am new hibernate user. I am trying to skip one of the field in the bean, from mapping to databse. But it throws error , how to do it. Is this possible to to something like this.

private String notes;
private Long authorId;
private String authorName;

// Want to skip this field from mapping to database,
private List<Page> objects;



Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, for columns: [org.hibernate.mapping.Column(Objects)]
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)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:753)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:691)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1390)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1359)
... 71 more


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 12, 2007 3:33 pm 
Newbie

Joined: Wed Dec 12, 2007 3:04 pm
Posts: 9
Sorry to mention that, I am using annotations.


Top
 Profile  
 
 Post subject: Skip the field in the bean from mapping to database
PostPosted: Wed Dec 12, 2007 4:13 pm 
Newbie

Joined: Wed Dec 12, 2007 3:28 pm
Posts: 2
Hi PenMa,

I think you can use @Transient annotation.
see: http://www.hibernate.org/hib_docs/annot ... ations.pdf

book page 5 or page# 9 in adobe acrobat.

regards,
pep79.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 12, 2007 5:01 pm 
Newbie

Joined: Wed Dec 12, 2007 3:04 pm
Posts: 9
Hi thanks for your quick reply, It works.

~PenMa


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.