Frage

what we are planning to do is we want a single project but want to use three different frame works to-gather, so is it a good idea or can this is achievable ?

we have already project build up with spring and hibernate but we want to extend it with jdbc template.

please guide on common quetions like -New Session factory required or not ? -Can we use pojos with hibernate annotations with jdbc template or we have to create new one ? -Will this create problem on performance if average is 500 users at a time ?

Thanks in advance.

War es hilfreich?

Lösung

Using both an ORM and JDBC in the same application is a reasonable thing to do. Hibernate can run native SQL queries so you might consider that as an alternative depending on what you have in mind.

JDBC doesn't use a session factory or entity manager factory comparable to Hibernate. Caching for the JDBC results would have to be handled separately from Hibernate.

The Hibernate/JPA annotations will be irrelevant to JDBC queries, the RowMapper passed into the query controls how pojos get populated. You could re-use your Hibernate entities to be populated by the rowmappers but in practice the reason you use JDBC is to get more focused results with flatter objects and you end up with a separate set of DTOs.

I'm not clear on what you think is going to hurt performance here. JDBC should be an improvement over Hibernate performance-wise, though at the cost of having business-logic spread out in multiple places. The tricky part will probably be setting up the transaction manager so that JDBC and Hibernate use the same transaction, see this question.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top