views:

47

answers:

2

Say you had:

  • a database
  • a bunch of .NET Windows GUI programs
  • a bunch of Java web applications

you could use Hibernate for the Java stuff and NHibernate for the .NET stuff - but would the two actually interoperate or would they be entirely different stacks?

If not then is there a persistence framework out there that lets Java and .NET share business logic?

A: 

I believe not. nHibernate takes Hibernate as a reference, but they don't actually share code and are developed at different pace. You would have to know the limitations of both.

HeavyWave
+3  A: 

I can't talk for the Java people, but from the .NET side of things I believe the mapping files could be shared (xml files describing the relationship between database and objects).

Other than that, what would you want to share? Are you thinking business logic? Please define "share logic" a bit further.

You could have your Java people write the persistence code and expose it as RESTful services, then the .NET Windows GUI programmers could just code against that... or vice-versa.

Ultimately there shouldn't be much Hibernate/nHibernate code, since it's job is for you to no longer have to write so much data access code. What's left is application logic with minimal interaction with (n)Hibernate, which will be different depending on your language.

Timothy Walters
Thanks, yes I meant business logic. I was hoping to avoid web services but we'll see. Thanks.
Tarquila
Can mapping files really be shared? Normally they are set to "embedded resource" in Visual Studio and therefore embetted in the .dll afaik
Max
@Max: yes, unless you're trying to share the mapping files from the deployed client (which doesn't make sense), at the developer level they're just files in your source repository so they can be easily shared.
Timothy Walters
@Tarquila: Sharing of business logic between C# and Java doesn't have much to do with nHibernate or Hibernate, since they should be talking to your objects without any reference to Hibernate. That said the only easy way to share such logic is to expose it from one language to the other in some way, usually Web Services or something similar. If you can find some other way to get C# and Java to talk easily please let me know!
Timothy Walters