I have two SQLContainers with the folowing data structure:
SQLContainer SP:
FullUserName | tel | room
SQLContainer MT:
FullUserName | ComputerName | Domain | OS
In my opinion, the foreign key of the both SQLContainers could be: "FullUserName" field?!
How can i set relation (reference) between these containers to get the finally view like this:
FullUserName | tel | room | ComputerName | Domain | OS
?
Related
I have a requirement where I have to save employee detail to a child table, employee data remains the same for multiple parent records (columns as well), I want to use the existing child table to insert if not present and update if already present, how I can do that using Spring JPA / hibernate?
Parent Table
|id|project_id|owner_emp_id|developer_emp_id|lead_emp_id|tester_emp_id|
|:---- |:------:| -----:|:---- |:------:| -----:|
| 1 | 100 | emp_10 | emp_20 | emp_20 | emp_30 |
| 2 | 200 | emp_11 | emp_21 | emp_22 | emp_30 |
employee child table
|emp_id|first_name|olast_name|email|phone|
|:---- |:------:| -----:|:---- |:------:|
| emp_10 |..| .. | .. | .. |
| emp_20 | .. | .. | .. | .. |
| emp_30 | .. | .. | .. | .. |
| emp_11 | .. | .. | .. | .. |
| emp_21 | .. | .. | .. | .. |
| emp_22 | .. | .. | .. | .. |
from the above example when saving the child table during 1st record emp_20 data need to save only once. similarly, the 2nd record insert emp_30 already presents an update or ignores saving it, how to do this in JPA?
I am implementing my own algorithm in H2O's Java source code (under package h2o-algos).
How can I join two frames' rows (i.e. vectors) in H2O given H2O Java methods?
For instance, given two Frame A and B
Frame A:
| Id | Name |
| -------- | -------------- |
| 123 | John |
| 456 | Bob |
Frame B:
| Id | Name |
| -------- | -------------- |
| 789 | Alice |
I want the resultant Frame C to be:
| Id | Name |
| -------- | -------------- |
| 123 | John |
| 456 | Bob |
| 789 | Alice |
Is there a way to do this faster then: making new vectors, than create a new frame from the new vectors? I have read the documentation and found that the Frame::append() method would create new columns, not joining rows.
This functionality is called "row binding", it is not exposed as an API method. It is, however, available as a Rapids expression (simple scheme-like language). You can follow this example to row-bind 2 H2O Frames: https://github.com/h2oai/h2o-3/blob/master/h2o-core/src/test/java/water/rapids/ast/prims/mungers/AstRBindTest.java#L40 In a nutshell, if you have 2 frames with keys A and B you would run water.rapids.Rapids.exec("rbind A B").getFrame()
Consider this simple database schema:
User Relation Property
+-------------+ +--------------+ +---------------+
| -user_id | | -relation_id | | -property_id |
| | | -source_id | | |
| | | -target_id | | |
| | | -type | | |
+-------------+ +--------------+ +---------------+
The relation table contains multiple source and target ids (as STRING) from another tables and "connect" dynamically difficult types of entities. So the source_id can be a user_id and target_id property_id, but also other entities and vice versa.
Now I want in User the properties over the relation table when type is property.
#OneToMany(mappedBy = "source", fetch = FetchType.EAGER)
#Where(clause = "type = 'PROPERTY'")
#ElementCollection
private Set<Relation> properties;
This works perfectly fine. I receive the relation entity with the property id as string in target_id.
Is it possible to resolve this and extend the getter, so that i receive the real property entity?
Like calling the propertyRepository within the user entity. As a newbie in java and jpa/hibernate im a bit lost here.
I am having issues mapping the following using spring JPA. Let's say I have a order table which has two primary keys. one is a foreign key to customer and another is a foreign key to order Type as seen below:
Customer
+----+------+--+
| id*| name | |
+----+------+--+
| 1 | Joe | |
+----+------+--+
Order
+------------+-------------+
| customerId | orderTypeId |
+------------+-------------+
| 1 | 1 |
+------------+-------------+
OrderType
+----+--------+
| id | type |
+----+--------+
| 1 | online |
+----+--------+
the idea is each customer has a one to many relationship with Orders. the primary key of orders is a combination of the two foreign keys.
any help would be appreciated.
I'm really new to the Criteria API and I do not know how I can create a join query for the following situation. I already looked into the Oracle documentation of the Criteria API, but I could not make the examples work.
Say you have the following two tables in your database.
Item Export
---------------------------- ---------------------------
| ItemId | DateUpdated | | ItemId | ExportDate |
---------------------------- ---------------------------
| 1 | 02/02/2016 | | 1 | 02/02/2016 |
---------------------------- ---------------------------
| 2 | 03/02/2016 | | 2 | 03/02/2016 |
---------------------------- ---------------------------
| 3 | 06/02/2016 | | 3 | 05/02/2016 |
---------------------------- ---------------------------
| 4 | 07/02/2016 |
----------------------------
The corresponding entity classes are exact representations of the tables.
The query should join Item with Export, but there is no foreign key from Export.ItemId to Item.ItemId. Further, as a result the query should select Item with ItemId 3, because Export.ExportDate is before Item.DateAdded, and Item with ItemId 4, because the id is not in Export.
How can I do that?