java - List of Hashmap in one to many relationships -


In relation to one-to-many, I have 2 tables, what do I have to do, sub-tables in some categories (many Section) and display them. So for example, I have a field and product table, so there will be many products in one area, but there are many products in a specific category and I am going to show them all in one section. So what do I want to do:

  @Entity public square area {// ... here some code @ one (very worth fetchType.LAZY) Private list & amp; Lt; Hashmap & lt; Long, list & lt; Products & gt; & Gt; & Gt; ProductEntities; // ... some code here}  

any suggestions please?

Here is what I am doing but appreciate that there is a better solution.

@Entity Public Square Area {// ... Here are some codes @ one (very worth it) fetchType.LAZY Private List & gt; Products & gt; ProductEntities; @ Transjan Private Heshomop & lt; Long, list & lt; Products & gt; & Gt; ProductsMap; Public Hashmap & lt; Long, list & gt; Products & gt; & Gt; GetProductsMap (if (Product Entitlements! = Null) {For (Product Products: Products Entities) {List & quot; Products> ProductList = productsMap.get (product.getProductTypeEntity). GetId ()); If (productList == faucet) {productList = new arreelist & lt; Products & gt; (); } ProductList.add (Product); ProductsMap.put (product.getProductTypeEntity) GetId (), productList); }} Return Product Map; } // ... the rest of the code}

Comments