Hibernate perguntas e respostas de entrevista
Question: What does it mean to be inverse?Answer: It informs hibernate to ignore that end of the relationship. If the one-to-many was marked as inverse, hibernate would create a child->parent relationship (child.getParent). If the one-to-many was marked as non-inverse then a child->parent relationship would be created.In Hibernate, only the ārelationship ownerā should maintain the relationship, and the āinverseā keyword is created to defines which side is the owner to maintain the relationship. However the āinverseā keyword itself is not verbose enough, I would suggest change the keyword to ārelationship_ownerā. In short, inverse=ātrueā means this is the relationship owner, and inverse=āfalseā (default) means itās not. Suppose Stock is parent and StockDailyRecords is Child object. Inverse keyword is applied in one to many relationship. Hereās the question, if save or update operation perform in āStockā object, should it update the āstockDailyRecordsā relationship? 1. inverse=ātrueā If inverse=ātrueā in the set variable, it means āstock_daily_recordā is the relationship owner, so Stock will NOT UPDATE the relationship. 2. inverse=āfalseā If inverse=āfalseā (default) in the set variable, it means āstockā is the relationship owner, and Stock will UPDATE the relationship. If keyword āinverseā is not define, the inverse = āfalseā will be used, which is |
Salvar para revisao
Adicione este item aos favoritos, marque-o como dificil ou coloque-o em um conjunto de revisao.
Faca login para salvar favoritos, perguntas dificeis e conjuntos de revisao.
Isto e util? Sim Nao
Mais uteis segundo os usuarios:
- What is Hibernate?
- What is ORM?
- What does an ORM solution comprises of?
- What are the different levels of ORM quality?
- What the Core interfaces are of hibernate framework?