Tag Info

Hot answers tagged

11

For earlier versions of both the frameworks book authors were saying that if we keep configuration in xml files then it will be easier to maintain (due to decoupling) and just by changing the xml file we can re-configure the application. Back then annotations didn't exist. People hated the XML files, and Java got a horrible reputation because of them. ...


10

Consider what you're trying to achieve. Typically, the Command Query Response Segregation model works well for complex domains. The reason is that you're trying to do one of two things typically: Create/Update/Delete some complex domain entities Run analytic fetch queries (i.e. summation/aggregation queries) Hibernate works well for case 1 allowing you ...


9

Generally the DAO is as light as possible and exists solely to provide a connection to the DB, sometimes abstracted so different DB backends can be used. The service layer is there to provide logic to operate on the data sent to and from the DAO and the client. Very often these 2 pieces will be bundled together into the same module, and occasionally into ...


7

MyBatis is SQL centric. It heps you calling SQL statements and mapping results (tables) to object trees. The main benefit is that it is not an ORM. It does not map tables to object so does not suffer the orm impedance mismatch. Fits well for complex or legacy databases or to use db features like stored procedures, views and so. It is quite simple and easy ...


6

The EJB 3+ frameworks are actually pretty good as they came along with JPA as an answer for annotation configured Persistence frameworks, as well as CDI which allows for annotation configured dependency injection. You also add on top of that Weld. Spring on the other hand is just now catching up in the game with configuration through annotation. With that ...


6

The size in tables is by no means a concern when having to choose between the technologies. How could that possibly affect your choice? When you can map and generate your entities automatically, it doesn't even require you to write more boilerplate code when choosing an ORM. It's rather a question about the tradeoff between programming close to the database ...


6

If you're not seeing performance problems when retrieving all entity attributes, don't spend time on micro-optimization. Unless the attributes are very large, you probably won't see any performance difference in selecting only the columns you really need for a given operation as opposed to all columns. If you're really concerned about it, believe that it ...


5

You may also think of an alternative representation. Consider the objects used by clients as an "interface objects". A DAO objects then may be used as a truly "business objects". The business objects may (and usually have to) be tightly coupled with database to communicate with it in a most efficient way. An interface objects, on the other hand, form an ...


5

No, your database is still important NHibernate is an object-relational mapping (ORM) solution for the projects: it provides a framework for mapping an object-oriented domain model to a traditional relational database. Thus it is important to keep your database in a good shape. Otherwise, you may face with performance issues once you project starts to ...


5

The best way to do something like this is to do it in small steps. First, even when you add this group, the students are transitively related to single class. So while there is some kind of grouping on the inside, the outside interface might ignore this and present only Student-Class relationship. So first step might be keeping Student-Class relationship, ...


5

I am the writer of post in question. I have got my fair share of working on different technologies and different architectures. Based on above, I can safely say that having service layer and dao layer is always a good idea. DAO should be limited to only add/update/insert/select Entity objects into/from database and that's all. If you want to do anything ...


4

It's possible to query Excel sheets using SQL with ODBC. The sheets are treated like tables. You can even join the sheets like you would database tables! I'd recommend you try this option first. Google java + ODBC + excel for details. There is apache's POI libary. http://poi.apache.org/ I'm not sure if this works on the old "binary" format or just the new ...


4

If you've got a good grasp of HTML, CSS, and JavaScript, you have a leg up on many people who end up doing web development. The concepts behind JSP are very similar to PHP. The quirks are different. A servlet is the name for a chunk of Java code that serves a request. That's it really. The whole original Struts framework was a single servlet. I would ...


4

If you care about time, time should be in your database. Period. Want to see a case where using a sequence could fail (I'm not sure if the same might happen with MySQL autoincrements)? When you request a value from a sequence inside of a transaction, you don't just pull the next value, the DB reserves a whole block of values for you. This is done to ...


3

Clear the cache or reimport Sometimes Intellij gets in a tangle with projects. When that happens the general approach is as follows: Try Build | Rebuild Project If no, check that the project will compile from the command line If yes, then use File | Invalidate Caches followed by Build | Rebuild All If no, then delete your local project files and check ...


3

I would recommend using the Java EE stack (which is supported by all vendors: Oracle, IBM, JBoss, SAP, etc... offering both open source and commercial distributions). Web Service Layer JAX-WS for SOAP Web Services JAX-RS for RESTful Web Services Message Binding Layer JAXB the standard binding layer for both JAX-WS/JAX-RS. Persistence Layer JPA ...


3

Hibernate : Hibernate made easy. Tomcat : Tomcat: The Definitive Guide


3

For Tomcat, the official documentation is a good start. Tomcat: The Definitive Guide, Second Edition is also worth a look.


3

Personally I'd do the simplest thing that could possibly work: Don't auto-fix the bilateral relations. I've previously developed and maintained a system that (among many other things) did exactly this: ensure that the relations between business objects where always in sync with what the DB would look like (i.e. if you remove one item, the other is updated ...


2

I'll answer your question a bit more generically, since I haven't used Envers but have used Hibernate. Open source software is a mash of great technologies, communities, etc or mediocre ones. Even under a larger umbrella project like Hibernate, the individual sub-projects vary. If the community behind the Envers project is in fact just the creator, then ...


2

For Hibernate, I can recommend Java Persistence with Hibernate. I found it very useful and thorough - it may be that others feel it's too dense, but if you are an SQL expert already, I don't think you will have any problem with it.


2

Browser independence is relatively easy to achieve, and if this is a web application, then platform independence isn't an issue (unless you mean deployment platform), and java does provide this to a large degree. Database independence is an entirely separate matter. In 20 years of writing software I have not been able to properly crack that one. And, TBH, ...


2

I don't think struts 1 ships with an OpenSessionInView filter, but one way to manage sessions is opening sessions on a per-request basis, which are then accessed via the thread local pattern. This will keep the session open until the request is done rendering, meaning you can use lazily instantiated collections in your views safely. Spring ships with an ...


2

EJB has a lot of baggage. Part of that baggage comes from the fact that it was targeted at the wrong audience. The other part was that the first two versions were utter crap. If you look at the original EJB versions, the design was that an EJB developer could create a packaged solution that could be used within any EJB compliant container. For an in house ...


2

LibreOffice and OpenOffice could scale you to the moon. Headless Linux-Mac-Win. You can get the contents of spreadsheet with about 200 lines of code. Use the OpenOffice.org (or LibreOffice) APIs to open the spreadsheet files, access the data, perform the transformations, and then write the proper data into the new database. As long as your are not trying ...


2

Databases in general are made for handling multiple connections and requests at the same time through locking mechanism. The problem I might see in your scenario is more related to caching on the side of the database client applications. Refer to the documentation of Hibernate and PDO and understand what and how their caching works. You might want to check ...


2

Hibernate is well know for too much magic, unexpected behaviour and big learning curve. There are other frameworks out there which are more focused on simplicity and will let you be in control. myBatis is one of them, my project MentaBean is another one. I've written a blog post about it that might help.


2

Since the question refers to my comment, here's what I had in mind writing it. First of all, it is derived from the context of your original question. In other circumstances I could give a different advice. The point that made me suggest MyBatis is this: ...we encountered some performance problems. We decided to drop hibernate in favor of plain ...


2

Short answer: no, you don't need to learn Servlets and JSPs as a pre-requisite for Spring MVC and many other Java web frameworks. Let's get Hibernate out of the picture first. It's a persistence layer framework and it doesn't have anything to do with Servlets and JSPs. Servlet API is the lowest level for almost all Java web frameworks. Even JSPs are ...


2

No there is no difference when you setup Hibernate either way. Using maven or ant will only change the way you configure, build, deploy your project. The way you write Hibernate code will not change in any way if you use Maven or Ant. In maven pom.xml you will have to add the repository as documented below - <dependency> ...



Only top voted, non community-wiki answers of a minimum length are eligible