This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Help with mapping strange table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Help with mapping strange table" Watch "Help with mapping strange table" New topic
Author

Help with mapping strange table

Martin Podrouzek
Greenhorn

Joined: Sep 09, 2004
Posts: 10
Hi,

recently I'm making an application with legacy MySQL database. I'm using Hibernate along with JBoss. Everything works fine, but one table in the DB is "strange"


As you can guess bu running SELECT you'll get something like
5 John name
5 B surname
5 Mr. title
5 32 age

now,
when running session.createQuery(...).list(); I get 4 times 'name' collumn.
Running session.createQuery(...).scroll() I get empty ScrollableResult (not much surprise here)
I'm not even capable of mappging User using either @hibernate.bag, or @hibernate.set (I can't use List or map since I can't add index collumn to the DB), as this gives me errror.

XDoclet code:


Error it gives:
12:15:02,468 ERROR [Configuration]
Could not configure datastore from input stream
java.lang.NullPointerException
at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:241)

I have doubts, whether it is even possible solve this with Hibernate. I could get the data with JDBC, but I'd like to have my code as clean as possible.

Thank you for any advise.

Martin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with mapping strange table
 
Similar Threads
Querying tables with a one-to-many foreign key relationship
Hibernate - Query Issues With Many-To-One Relationships
Hibernate returning List with NULL values
Not able to view the data persisted in the database.
Problem in many to one relation.