aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Intellij and how it does Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Intellij and how it does Hibernate" Watch "Intellij and how it does Hibernate" New topic
Author

Intellij and how it does Hibernate

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
Coming from MyEclipse (if I can't ever figure out why MyEclipse won't debug on the Mac and OS/X 10.6.1), I was disappointed to see that Intellij IDEA doesn't auto-generate (reverse engineer) the Hibernate DAO classes from a database table like MyEclipse does.

So, my question is, how effective/productive is IDEA's Hibernate support?

Since I have to manually code, as I understand it, my own Hibernate DAO classes, do I also then have to manually update other Hibernate files and write my own SessionFactory class (and, possibly, manually take care of other Hibernate tasks like creating my own HBM files)?

Thanks in advance.

-- Mike
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why not just use HibernateTools with the default, or your own, templates? That's all MyEclipse is doing, IIRC.

(Of course, I never use Hibernate without Spring--yuck.)
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
How difficult would that be to set up inside Intellij?

Have you ever done that?

Thanks again.

-- Mike
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I do all that kind of work from an Ant or Maven build, since I use CI servers I need it anyway. Accessing Ant/Maven tasks from within IntelliJ is trivial.

You're lucky--I've never been in a situation where the stock MyEclipse reveng stuff was even passable.
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
Interesting, but doesn't sound like how I'd use it.

In MyEclipse -- through the interface, I'd right click a table from the database perspective and choose to reverse-engineer everything, and viola, it generates everything (HBM, DAO, AbstractDAO etc.) and updates WEB.XML, if needed.

MyEclipse also generates the other boilerplate Hibernate code (for example, the SessionFactory), so there's little wasted time typing.

However, since I'm having a show-stopper issue with MyEclipse on Snow Leopard, I can't currently debug with MyEcilpse. Sadly, I may be moving back to Windows so I can run MyEclipse.

Coming from MyEclipse, I didn't find Intellij intuitive.

Thanks.

-- Mike

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
David -- what did you mean by your comment: "You're lucky--I've never been in a situation where the stock MyEclipse reveng stuff was even passable."?

Have you had bad experiences with MyEclipse?

-- Mike
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, not specifically--just that it almost took me as much time to write a reveng file as it took me to write custom templates or just do it by hand.

That said, I bailed on MyEclipse some time ago because of its lag behind current plugins. Once I stopped doing Struts 1 development I never really saw a need for it.
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
Interesting.

I find MyEclipse saves me lots of time (when it works), but I've had my share of problems with it. Why MyEclipse now can't debug on the Mac is more than irritating. I'm not sure it's their problem, however, since it started with Snow Leopard. However, standard Eclipse has no problems debugging so I'm not sure what to conclude there...

I never realized when buying the Mac how locked down things were .... like the Java JDK.

Thanks again.

- Mike
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

While I'm not going to give up my Mac any time soon, the JDK is its weakest link (for me--I'm about 75% Java, 25% other). I suspect I'll just get a new 17" MBP with the failure of my current graphics chip, throw 8G in it, and run a virtual Linux machine :/
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
David,

You raise an interesting point, and possible workaround for me.

I have VM Fusion installed on my MBP, but why would I want to try to run MyEclipse on a 2GB RAM Windows "partition"? Wouldn't it make more (productivity) sense to get a rocking fast 8 GB Windows 7 machine (assuming these two terms aren't mutually exclusive <g>), and work that way? VM Fusion may "work", but it's not "fast".

I then ask myself, why do I have a Mac to begin with if I do all the development in Windows (OK, it doesn't crash, and all that, but still)?

Not sure how to reconcile these issues.

I'm really disappointed with Apple and its treatment, or lack thereof, with Java.

-- Mike
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

A lot of the more all-encompassing plugins for Eclipse have been frustrating and disappointing to me. IntelliJ, for better or worse, had less plugins anyway, last time I worked extensively with it. Although it has more built-in functionality in its prime target areas.

The upshot of it is that I use external tools for stuff like that. At the moment, in fact, I'm using the Apache OpenJPA reverse-engineering tool, even though I'm not using OpenJPA itself right now. Since JPA is a portable standard, it works just fine with Hibernate.

Customer surveys are for companies who didn't pay proper attention to begin with.
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
So, you're saying you'd be running Intellij over here and when you wanted to, say, reverse engineer a table into a Hibernate DAO, you'd run the Apache tools "over there" and have Apache reverse engineer the DAO class (for example) into your project folder?

- Mike
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Mike London wrote:So, you're saying you'd be running Intellij over here and when you wanted to, say, reverse engineer a table into a Hibernate DAO, you'd run the Apache tools "over there" and have Apache reverse engineer the DAO class (for example) into your project folder?

- Mike


It's been my experience that repeatedly reverse-mapping ORM can wreak havoc on a project, especially if you're so unwise as to customize the output (like for example, providing enhanced "toString" functions or alternative data type setters). So I do it as rarely as possible, and for safety's sake, I normally generate the code elsewhere and merge it into the project manually. Because of that, I don't have a major problem with doing it "offline", so to speak. YMMV.
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
Sounds reasonable to me.

I think I'll be headed back to Windows 7. I can't stand the constant problems I'm having with the Mac and now with Snow Leopard.

Thanks!

- Mike
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I wouldn't run MyEclipse in a partition--I wouldn't run it at all, at least not to solve the problem you're solving.

I use VMs in the rare cases something doesn't work on OS X due to its JDK (like the Struts 2 build, which spins during one particular test case) or to run my servers. VM performance has never been an issue for me; I'm not running the same one you're running, but I get probably 75-95% native speed.

And "productivity wise", no, I wouldn't go near Windows with a ten-foot pole. I'm measurably more productive on a Mac or Linux.
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
Ok, so just that I'm clear, you wouldn't be averse to installing a Linux VM on the Mac to run some program due to the .... $*(@*##!! Java VM on the Mac?

In a sense, if I'm sitting in a code window all day, then I suppose where a particular program is installed isn't that big a deal...

-- Mike
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's what I do--but you sound like you're having far more substantial issues than I ever have. So far I've only run in to two "stoppers", one of which went away with Leopard, one of which was introduced. IIRC I stopped using the 64-bit Java, but I can't check right now (display finally gave out after a few years).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Intellij and how it does Hibernate