Fabrizio Gianneschi

Ranch Hand
+ Follow
since Nov 29, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Fabrizio Gianneschi

Hello all,

we published a review of the Bruce's book on our Java User Group website.
Check it at:

http://www.jugsardegna.org/vqwiki/jsp/Wiki?BetterFasterLighterJava

At the moment, only the italian version is available.
Maybe it's only a jdbc driver problem?
Which Hibernate dialect should I use to connect to a Microsoft Access database? It's for internal testing purpose.

I tried the SQLServer dialect (+ the jdbc-odbc bridge) but it didn't work, due to a unsupported jdbc operation.

Thanks

Originally posted by Ko Ko Naing:


Thanks for the link to your review....

It seems the book's rating is pretty good and people out here may find the review helpful for them as well...

Is that the first book in developer's notebook series of O'Rielly? Or any other books before that?

Thanks...



Honestly, I should rated it 4/4.5 instead of 5 stars, because now I'm realizing that it didn't explain how using Hibernate on web applications, which are now a fundamental argument. You could consider it a quick and simple introduction to H.

I don't know if it was the first book of the series, however now there're surely other books available.
All right; docs are extremely clear.

Thanks to Ali Pope and Gavin for the response.
I tend to prefer Hibernate simplicity when mapping domain objects than focusing into performance issues.

POJOs and a bit of xml are FAR simpler to code and mantain than ejb's home/local/remote interfaces and architecture. You've to add the complexity of the container, too.
Suppose we have two or more threads. Each thread obtains its Session from the SessionFactory and loads/saves some objects.
I wonder what is the concurrency status of these objects. In other words:

-if two threads execute the same "find" query, are the instance objects the SAME or only "equals"?

-if two threads are working on two persisted objects obtained from the same query (suppose in different methods), are subsequent changes to the first object automatically propagated into the second one?

Tks

Originally posted by Gian Franco Casula:
Hi Pradeep,

I've come across the title 'Hibernate: a developers notebook'.
Of what I heard this must be a useful introduction to the
subject, actually if I'm not mistaken the bookporch has a
review for it.

and, Manning's C. Bauer & G. King book

Cheers,

Gian Franco Casula




I wrote a review of this book on our Java User Group website. It's a good book, expecially for beginners. To master Hibernate, however, I guess you should choose another book, like Bauer & King's one

The link is:
http://www.jugsardegna.org/vqwiki/jsp/Wiki?HibernateDevelopersNotebook_En (in english)
and
http://www.jugsardegna.org/vqwiki/jsp/Wiki?HibernateDevelopersNotebook (in italian)

Originally posted by Ali Pope:
I think a 1-1 relation is somehow (at least theoretically) different than a composition. This differentiation can be found also in UML.

You must decide which is the lifecycle of both your entities and this will help you determine how to better persist them.

/pope



Yes, it's true. Use a 1-1 association when both entities could exist in your model even without the other one. For example, consider "man" and "woman" entities and the relation "isMarriedWith".

Instead, consider composition when one entity cannot exist alone. So this is not really an entity, we call it a "component". Like the example I mentioned in my last post.

So, my solution was only for composition, not to 1-1 relations, sorry.
Here's a question for Hibernate experts:

Is there a way to avoid populating the classpath (and source path) with .hbm.xml files?

I honestly prefer the "monolithic" configuration file approach, so can someone tell me why this practice is considered bad on Hibernate when defining the mappings?

Thanks in advance

Originally posted by Vinicius Boson:
Thx Gavin King,

One more doubt.
Assume that I have an one-to-one relationship, like client <-> address
If i project only fields from the table client, will hibernate make a join with address even the fields that i�m projecting is only in the table client ?

Regards,



I solved this problem just today experimenting with Hibernate... that's my solution:

When you want to realize "part-of" relations (like user--address) you can declare a <component> into the User definition (User.hbm.xml) and map it on the adress fields. (see Hibernate docs at
http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-component)

So Hibernate doesn't make any join... it just creates an User class instance and an Address class instance into it.

Originally posted by Dominique Ramoney:
Thanx guys

So it appears that since the trim suggestion didn't work, there is no way to represent a string such as "firstname lastname" as an integer?

Oh well, back to the drawing board.



I'm not sure if this is the type of solution you're looking for... however, there's a method to generate an unique integer from a String and it's called "hashcode()".

Example:

String s = "abcde";
int i = s.hashcode();
20 years ago
Your class is in the "com" package.
So you should go back one folder and invoke the java command from that position.

>cd ..
>java com.Test
20 years ago

Originally posted by David Hibbs:

Why should Struts try to do something different from what the Servlet Engine or J2EE spec do?


To simplify programmer's work. It's the n.1 reason when using a framework. I think default implementation should be thread safe, even if it's slower than the actual one.
Then, if there're performance problems, I could switch to a better solution (provided by the same framework, or manually)... pools, cache and so on.
...but that's only my opinion.
[ March 23, 2004: Message edited by: Fabrizio Gianneschi ]
20 years ago
Wow! I'm very happy!
Thanks a lot... you will see a review of the book as soon as possible on our Java User Group Site: http://www.jugsardegna.org
Bye
20 years ago