This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Exception in OneToMany Mapping(annotation) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Exception in OneToMany Mapping(annotation)" Watch "Exception in OneToMany Mapping(annotation)" New topic
Author

Exception in OneToMany Mapping(annotation)

Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
Can anybody tell me when will i see this exception incase i am creating one to many mapping between orders and orderlines


2008-06-03 14:14:47,164 DEBUG [utils.HibernateUtil] - In Initialization Exception ------ >>Could not determine type for: java.util.List, at table: ORDERS, for columns: [org.hibernate.mapping.Column(orderLines)]

Any help is highly appreciated.

Thanks,
Rahul


Rahul Juneja
ThoughtClicks - http://techlabs.thoughtclicks.com
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Any chance you're missing a targetEntity attribute in your mapping?



-Cameron McKenzie
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
Below is the code, target entity is already

Orders:

@OneToMany(mappedBy="orders", targetEntity=OrderLineItems.class)
public List<OrderLineItems> getOrderLineItems() {
return orderLineItems;
}

OrderLineItems:

@ManyToOne
@JoinColumn(name="ORD_ID", nullable=false)
public Orders getOrders() {
return orders;
}

Thanks,
Rahul
[ June 03, 2008: Message edited by: Rahul Juneja ]
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
I am using calling this from a session bean which is exposed as a webservice. Does it matter by any chance.

Thanks,
Rahul
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
Can anybody help me on this ?
Rodrigo Lopes
Ranch Hand

Joined: Feb 29, 2008
Posts: 119
Take a look at the name of the attributes/getters.
The exception message mentions a column orderLines, while in your code there's a collection named orderLineItems
Just guessing...
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
Thats a type from my side. Its the same name in reality. Its because i was trying to put a dummy name and forgot to do that in exception.

Any Other Clues ?

Thanks,
Rahul
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in OneToMany Mapping(annotation)
 
Similar Threads
please, help me to solve sun.jdbc.odbc.JdbcOdbcDriver cannot be cast to javax.sql.DataSource
EJB design
Hibernate 3 Annotations
Mapping a qualified association with Hibernate
Hibernate collection mapping