but then I get absolutely dreadful performance. Of course, I can just turn off lazyloading. When I look at my day and ask, "What did I produce today?" - I find problems like this really get in the way of me feeling like I accomplished something. Im trying to get a list of all the users from 'users' table and I get the following error: .ast.QuerySynta圎xception: users is not mapped from users. For help clarifying this question so that it can be reopened, visit the help center. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. In the end, I just feel that details like this really weigh me down. Its difficult to tell what is being asked here. I feel like it's just getting in the way of what I am actually doing. It takes so long to fix one of these errors. when I discover them in Tomcat, I often have to shut down tomcat, make the changes, recompile, reload tomcat, relogin to my application, go back to the page I was at to see if it's fixed - this is truly a massive pain. Or maybe Spring is accessing a property I never asked it to, so it throws a LazyInitializationException anyway - for no reason other than that their framework touches all of my bean properties.Īnyway, because I can't discover these problems during integration tests. It feels even more bloated when these exceptions occur from frameworks - like by Jackson calling into a collection that hasn't loaded yet. I often don't discover lazyloadexceptions until I deploy my application into Tomcat. It seems that the loading strategy that you want to use should be independent of the mapping information, but this is not possible (as far as I know) with hibernate other than writing the loading inside of your java code.Īnother problem I have with the lazy-loading is that it's not easily predictable when you are going to have problems. This is just bloat that doesn't do anything to solve the real programming problems - like the features that get the project done. Hibernate is an object-relational mapping (ORM) library for the Java language enabling developers to utilize POJO-style domain models in their applications in ways extending well beyond Object/Relational Mapping. If you want to satisfy both parts of the program, you need put up with lazy-loading and manually load entities and their children. The reason I hate the lazy-loading model is that while it's convenient to specify what is lazy and not lazy in the configuration file, there are many parts of an application that would prefer lazy-loading in one area and no lazy loading in another. Statement statement nnection ().createStatement () ResultSet rs statement. Absolutely hate it - there has to be something better out there. When measurering the java code in the jvm on a small dataset of 3500 rows in MyHibernateClass database table this takes about 7000ms. Most of them are not that big of deal when you have as much experience with it as I have, but I think the biggest problem that I run into is one-size fits all lazy-loading model. There is a lot I like about Hibernate, but there are lots of problems too. I am unsure if there is a better way to develop database-backed applications in Java, but I thought I would ask.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |