I'm making a web app. It gets data from a SQL db. I had some code in jsp to query the db however, that code would be available to the user - via source code - not a good practice, right? So, I decided to use entity classes - bc, that's what netbeans seems to want me to do. However, the "entity classes from database" ~wizard, will not create the classes for me (it freezes) so, I've resorted to building the classes myself - and this is very, very difficult (at least for me...) and I have not been able to get the classes to work. Soo, the question is: should i be using entity classes or something else? and, if something else, what hibernate? or....????thx!
-
you can use hibernate or jpa – Biswajit Apr 05 '13 at 18:51
-
can you give scenarios where i'd like one over the other? – Patrick Bailey Apr 05 '13 at 18:56
-
i have given an answer.please check – Biswajit Apr 05 '13 at 18:57
2 Answers
Actually the source code of a JSP file is NOT available to the user. JSP files are compiled in the java class files which then generate HTML which is sent to the user's browser. The only thing the user has access to is the generated HTML, the output of the JSP page. Simply put: JavaScript is visible to the end user, Java source code is not.
If you want to build entity classes with netbeans, I recommend that you start with a tutorial rather than your own database, like this one for netbeans 7.1.
I recently did a project using Entity classes that were built with jooq and I was happy with the results. If you don't need to use hibernat or JPA, you might want to use jooq. I found it simpler and easier to work with.

- 4,015
- 4
- 23
- 42
I suggest using an MVC framwork. The model part will get the data from from entity and using hibernate or jpa you can create entity classes.
-
i was doing the Affable bean tutorial (netbeans) are you familiar? it uses SQL in the jsp, then goes into mvc and then into entity classes...but, the orriginal sql worked fine but, it seemed like it wasnt secure or proper... – Patrick Bailey Apr 05 '13 at 19:05
-