Hibernate Stored Procedure Dilemma [closed] - java

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What is the best way for replacing stored procedures in your database when you are moving to Hibernate. Imagine a java application that is working on its own without Hibernate, and then one will decide to use Hibernate. What is the best practice to do that? Shall I leave those parts using stored procedures intact and one by one get rid of the stored procedure and make it a stored procedure free program? or shall I HQL to call the stored procedure?
Look at it this way, isn't using stored procedure in contrast with using Hibernate? Isn't the purpose of using Hibernate to free coder from dealing with Relational mapping? If you have to deal with Stored procedures in your application, is it worth it to deal with Hibernate? If you have the knowledge and time to deal with Stored procedures, you better to use native sql rather than Hibernate?
Any ideas?

You could implement functionality similar to stored procedures using hibernates event system, http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/events.html
if its a good idea or not is a rather open ended question. I think, it depends on many different factors. Most importantly, what exactly are you building, what kind of team is working on it and how well is it documented.
Having things happen automatically, can be really neat, if its really well documented and if the developers actually pay attention to the documentation. Otherwise, it can lead to heaps of confusion. I suppose you have to ask the question, what is the benefits (if any) of using it, versus what the negatives are in your particular case. And make a decision based on that, I doubt very much you will find a right or wrong answer from what other people have experienced in the teams they have been working in, since it might not necessarily be appreciable for the project/team you are involved with.

Related

PostgreSQL vs MS SQL Server compatibility with java [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have to design a Java Application, which has database connectivity as well. I am unable to decide which database should i use? "PostgreSQL" or "SQL Server 2008". I want to know which has better compatibility with Java language? Also which one is more easy to use and implement?
This is a very subjective question and one that will likely be closed, but for what its worth, this is my opinion:
Both database servers are compatible with Java using JDBC and several ORM's such as Hibernate.
Instead of Java compatibility what you need to consider is:
Your resources (financially and computationally)
Your familiarity with one DBMS over another
SQL Server tends to be a bit of a hog for installation. For management tools your looking at SSMS, which can be a bit of a beast, but is very good at what it does.
PostgreSQL is lighter on the installation front. The PgAdmin III tool is very effective at what it does, and is, in my opinion, easier to use.
SQL Server's free editions have database limitations. It's paid versions do not, but they are expensive. PostgreSQL does not have any limitations for database size, and it's open source.
Both DBMS's have a vibrant community and help is readily available.
Hope this helps.
--Edit--
As a starting point for databases, each database server will be as easy as any other to learn on; although the tools that the server provides may temper the learning curve some.
Should I have to go back to square one and relearn everything again, heres what I would do:
Pick PostgreSQL. I would chose PostgreSQL to learn on as it is fully ACID compliant, has little tolerance for syntax errors, and provides exactly what you ask for in the result sets.
I would learn the command line utilities first, followed by PgAdmin III as it would give me the best possible exposure to the database, without holding my hand.
Read the documentation found on PostgreSQL.com and supplement questions with Stack Overflow, and dba.stackoverflow.com
DON'T PANIC. Learning a DBMS is a tall order, one that I have yet to complete. There are times when it is frustrating and hard. It will be easy to want to quit. Don't. Hang in there and keep trying, the rewards are worth it.
The PostgreSQL community is great, and the answers I have gotten, and seen on other posts here on SO are top notch. For some samples, check out any answer by a_horse_with_no_name and Erwin Brandstetter, I guarantee you will learn something.

Hard Coded SQL statements VS. Web Service to execute the queries [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm developing a Java application that communicates with a MySQL database in a server. The app should be able to read some data from an XML file and then insert the info read into the database.
I used to write SQL Statements directly to the Java code, but then a friend advised me to create a web service that does all the SQL stuff for the tool, and let the tool's only job is to read XML and send data into the web service.
My question is, does it deserve that effort? Why or Why not?
SQL in code is not recommended as it becomes difficult to maintain. The application is also tightly coupled to the database structure. Every time the database change (or you are moving to a new database) you need to make changes to your code and release again.
I don't think a web service is the correct answer here. I would recommend you try one of the following:
If your application uses a lot of tables and very high throughput is not critical, use Hibernate as an ORM tool. It has many features and can really reduce the time spent on data access.
If you do not have that many tables and you don't have the time to learn Hibernate, use iBatis. It will take you 30 minutes to grasp. It essentially allows you to put your SQL in a separate XML file, which it will read for you. For smaller applications it is really useful and it is faster than Hibernate.
As a last resort, rather put your SQL in a text file(s) which you open and execute.
How do you intend to create the webservice part? If you have the time to do, worth trying with Core Java or any Webservice framework, though I would suggest use Core java which would help to keep minimal dependency for your tool. Nevertheless, there is an ample amount of effort required to get the XML and Webservice requests in sync. My take - if it is not broken, dont fix it.

Which embedded RDBMS should I use with Java? Why? What about backup and maintenance? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm relatively new to Java and using DBs with it, and I need help deciding which embedded RDBMS to use with a simple J2SE system. My criteria and concerns are: performance, low system requirements, reliability, easy of use/develop/deploy/maintain/backup/recovery.
1) Before I was deciding between Firebird and SQLite, but then I've just met H2, HSQLDB and Apache Derby, and now I don't know which one to choose. Any of them would fit for me, but I need to explain why I choose one of them.
I believe I should use one of the native Java ones, since they can run inside the same JVM (which might use less resources). Which one do you suggest and why?
2) I also would like help on finding backup/recovery/maintenance manuals, tools and commands for H2, HSQLDB and Apache Derby, since I was not able to find this information on their website (not because the documentation is bad, most likely I'm a bad seeker)
P.S: this might be a good source for others with the same problem, but be careful because the information is not fully up to date: http://database-management-systems.findthebest.com/compare/6-13-15-16-53/Apache-Derby-vs-Firebird-vs-HSQLDB-vs-H2-vs-SQLite
H2 was written fairly specifically to be faster than HSQL and Derby. Its author has run some benchmarks which, although they are rather old now, indicate that this goal was attained. According to those benchmarks, H2 is a bit faster than HSQL, and H2 and HSQL are much faster than Derby.
I don't know anything about management tools for any of these databases. Since they're embedded, they store their data in local files; it should therefore be easy to handle backup and restore by backing up and restoring their files.

Does the use of nosql (say mongodb) increase development productivity? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I develop 3 to 4 Spring Roo applications a year currently with Hibernate and MySQL. It has been stated here at Stackoverflow that relational databases are not the best fit for a typical object oriented webapplication .
If your DB is 3NF and you don’t do any joins (you’re just selecting a bunch of tables and putting all the objects together, AKA what most people do in a web app), MongoDB would probably kick ass for you.
There are various reasons for this. One is productivity as objects are mapped to a relational schema ("joins" etc.). Would the use of MongoDB or CouchDB increase development productivity given the same level of expertise as with MySQL?
I think it really depends on the web application. Non-relational databases (NoSQL) excel where you either
Don't want a schema (want to be able to store different sorts of data in the same table), and/or
Don't have too complex of relation between objects.
NoSQL can definitely make it easier to get off the ground faster, because you can just throw stuff in however you want, but on the downside as things get more complex sometimes you want a little more forced organization. Foreign keys are something I really miss when working with Mongo, just being able to (using an ORM) hop from one object to a related one or set of them is great. (Yes in many NoSQL dbs you can store documents, but at some point you need to use a separate table for something.)
I would highly recommend NoSQL for a brochure style website, where the client is just entering text fields, or a twitter-style site, where largely you are storing lots of one type of data with few attributes. But if you're going to be creating a CMS with revisions and workflow and such, you're going to want the ability to have explicit relations in SQL.
Which brings me to my answer: use the right tool for the job. A trained developer would be able to make some sites faster and better with SQL, and other sites faster and better with a non-relational database.
But try out MongoDB or CouchDB and get a feel for it, that way you'll have a better intuition on when to use what. (We use both at my job (not at the same time!) depending on the project)

Any Open Source software using Orient DB database? Have you any experiences with that database? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Do you know any open source software that uses Orient DB? Or have you used that product yourself? Any experiences to share?
I have recently looked into Orient DB, and it has nice and interesting feature set (fast, embeddable in Java, simple API) but it seems that it is not widely used. Is it just because the Orient DB is a new player on the field?
After the total failure of ODBMS (at least from an adoption point of view), it seems obvious to me that the NoSQL movement is perceived by (ex) ODBMS players (like Versant, db4o, Orient) as an opportunity for a resurrection.
This IMHO exactly the case of OrientDB which is the result of the rewrite of the Orient ODBMS engine as a document oriented database (in other words, re-branded to fit in the NoSQL niche market).
But while OrientDB benefits from the experience acquired in the ODBMS field (the author has more 10+ years of experience in this field and is member of the JDO expert group, how surprising), I'm not aware of any projects/customers using it (and I believe they would publish some testimonials if they had many of them). Some possible reaons:
The product is new.
Only a very few people might need a NoSQL solution.
The conjunction of both points means you won't see "mass adoption". At least, this is my opinion.
That being said, I agree that OrientDB looks interesting.

Categories

Resources