• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Newbie Hibernate questions

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am just getting into Hibernate at the moment.

I have a db table, called 'fw_items', with over 255 fields, and am using Netbeans for the project which creates the corresponding 'FwItems' class.

Q1. Why has my FwItems class been given three constructors?
Q2. One of the constructors has over 255 parameters, so doesn't compile. Is it safe to just remove this constructor?
Q3. Before using hibernate, some of my queries were very slow. (My SQL is quite well optimised. The main problem is due to the size of the table (over 40k records).) Are there any features available within Hibernate to help speed up query time?
Q4. How do I incorporate a FULLTEXT search into my HQL?

Many thanks in advance!

Cheers,
James
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Convenience? Not sure. What are the three constructors? Default (no parameters), key and all 255+ parameters?
2) Yes. If there were only a few parameters, this would be convenient. After 5-10, it isn't convenient anyway.
3) Take a look at lazy properties to only get some properties on first load. Whatever you do, be careful. If the problem is returning so much data over the network, see what you really need. You might also consider using a view or customization to return less fields. If your time is occurring due to going through the actual table, check you have the right indexes and Hibernate is using them. Just like you carefully tuned the SQL, you will needs to spend some time on the ORM layer.
4) Don't know.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
40k records is a lot? That's a trivial amount of data. Is it a long-running query in raw SQL? Is it 40k *results*? If so, do you need each column, or can you get away with on,y some? It sounds like the table has 255+ columns-that's quite a few, and means a lot of objects.

Without more details, it'll be hard to help much more yet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic