2014年1月2日星期四

hibernate given conditions to find out how to improve the efficiency

Do have a list, kept the name
need to find the name corresponding to the id in a table
I think the approach is to traverse the entire list, and then went to check , the return is also a list
determine the size of this list , and it is more than a proof of an error , because the name is the primary key , one pair does not appear much , if less than 1, the proof is not found, if it is one , that is, the value
This efficiency will not be too low
------ Solution ---------------------------- ----------------
table design can be optimized through . The name of this table you saved the best table ID. Interface display name. The value stored in the database stored in the ID value . ID correspondence , queries will be faster than it is a little
------ Solution ------------------------ --------------------
I think you put the name and id of another table into a map where name is the key id is the value then the two sets to filter , to improve the performance of a lot better than you that you
------ Solution ----------------------- ---------------------

landlord of this function means that you receive a list of employees is a collection of objects based on a collection of employees inside the check out the name of the corresponding salary information collection , this collection of information should be the order of the salary of staff and collections sequence is the same, which is the first name of the first employee 's name and salary of employees is the same collection .
If this is the case or say I started to fight with in a manner directly to hql or sql -time salary information check out the collection . then as long as the changes in the order of the sequence into a set of the same set of employees on the line can list.set (int index, Object obj);

------ For reference only ---------------------------------- -----
Do not loop the investigation, the cycle time can be generated string parameter in condition to fight a one-time check hql or sql
------ For reference only ------- --------------------------------

ah , this approach is good, taught the
------ For reference only --------------------------------------- < br>
I said do not know

For example, I have a list, there is a staff category , name, sex , salary, address, etc. , now have additional information , and pay wages need to look through the names to the list , and then write the class of employees salary variables inside
I think it seems only checked one by one , I do not know hibernate there is nothing more special than a method can check the efficiency of a point
------ For reference only ---- -----------------------------------
you with related entities directly on the use of employee class ah hibernate one to one mapping of employees and salary table with the association to delay initialization , so hibernate will automatically detect the association staff salary information at the time .
------ For reference only --- ------------------------------------
 or do you have a level of expression . . . . . .
------ For reference only -------------------------------------- -

turnover , employee data is only data , another argument over the function returns , the database does not exist , my task is to check the good and then return to this list
------ For reference only ---------------------------------------

amount employee data only data , another argument over the function returns , the database does not exist , my task is to check the list and then return to good   .
landlord is saying that you can not change it if you can not use the associated entity related entities , then you passed in that list is a collection of what is kept employees entity class name or employee name only collection of strings
- ----- For reference only ---------------------------------------

turnover , employee data is only data , another argument over the function returns , the database does not exist , my task is to check the good and then return to this list          
landlord is saying that you do not change the associated entity if the entity can not be associated with it, then you passed in the list that is what is the surviving entity or a collection of classes of employees employee name name only collection of strings  
I do not know == expression class is a local class of employees , what is the name of a string is the string I can also , I wanted to but the simplest one an outside investigation to improve a little efficiency , because it is frequently used
------ For reference only ------------------------------- --------
can be used in the design of the hash table

没有评论:

发表评论