Posts

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:

Problem I had two objects Contacts and Groups having many-to-many association. A Contact can belong to multiple Groups and a Group can contain multiple Contacts. My objective was to return a set of Contacts along with the Groups they were associated with. But if the Contacts-Groups association is set to Lazy load then the above exception will be thrown. Solution 1. FetchType can be set to EAGER and everything will work fine, the Groups will be loaded; but in a more general case, where the graph of java objects can grow very large, the use of eager fetch may cause unnecessary data to be loaded and the application will be slowed down. 2. Another solution is to explicitly load any lazy-loading the required fields actually hitting a method on those properties ex: contact.getEmailSet().size(). But this will result in subsequent sql firing which are required to load Groups (Child) Will also slow down the system. 3. Another solution is to include "fetch join" whi...

A Solution to Hierarcy Cycle Problem with JSON: JSON Filter

When you have a cycle in your domain model, beacuse sometimes you realy need it*, then with Spring JsonView, indeed you may have same problem in different cases, while converting Java objects to JSON objects, you can get en error : net.sf.json.JSONException: There is a cycle in the hierarchy! with a following unusefull stack trace:) First of all, think carefully fi you really do need this cycle in the dependency. If you don’t, remove it. If you do, the you can use, JSON filters. I will give an example code to show it. In the code, resulting JSON object will contain only id, name and description fields and values of the objects. JsonConfig config = new JsonConfig(); config.setJsonPropertyFilter(new PropertyFilter() { public boolean apply(Object source, String name, Object value) { if ("name".equals(name) || "description".equals(name) || "id".equals(name)) { return false; } ...

how to submit a Ext.form.Panel to a specified URL with params?

var panel = Ext.create('Ext.form.Panel', { id: 'businessUnit-form', url: 'createNewBusinessUnitForList.htm', ..... .... ..... }); formCmp.getForm().submit({ method:'POST', params:{ id: id, status: status, articles: aArticles }, ... ... });

Change Proxy URL dynamically

someStore.getProxy().url = "xxxxx"; someStote.load(); ext 4.0.2a

Can you help me to do this? - extjs4.0.2a problem

Following I have given you the source code. There I am doing my update to the database by simply double click on the row and then when I am going to delete a record it will return a message as there have a data violation. up to this level the program is working in well manner. But the problem is after that delete , if I go to update any record, the proxy executes update and then destroy(delete) again. For your further ref - when I remove some records from this store without page refreshing, it seems that all previous deleted items are stored somewhere and sended to servlet on every new update. When I refresh page, first update is ok, but any next update again after removing a record accumulate previous removed records. What I do wrong and how I can fix it? ====CODE==== ============ /* Ext JS 4.0.2a */ Ext.require(['Ext.data.*', 'Ext.grid.*', 'Ext.dd.*']); Ext.define('StakeholderType', { extend: 'Ext.data.Model', field...

ExtJS, Spring MVC 3 and Hibernate 3.5: CRUD DataGrid Example

http://java.dzone.com/articles/extjs-spring-mvc-3-and?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+javalobby%2Ffrontpage+%28Javalobby+%2F+Java+Zone%29

GUI sample for grid panel with extjs 4.0.2a

Image