| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| |
| Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. |
| |
| This program and the accompanying materials are made available under the |
| terms of the Eclipse Public License v. 2.0 which is available at |
| http://www.eclipse.org/legal/epl-2.0, |
| or the Eclipse Distribution License v. 1.0 which is available at |
| http://www.eclipse.org/org/documents/edl-v10.php. |
| |
| SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause |
| |
| --> |
| |
| <entity-mappings version="2.3" |
| xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| |
| <package>org.eclipse.persistence.jpars.test.model.dynamic.auction</package> |
| |
| <named-query name="Auction.all"> |
| <query>SELECT a FROM Auction a</query> |
| </named-query> |
| |
| <named-query name="Auction.forName"> |
| <query>SELECT a FROM Auction a WHERE a.name = :name</query> |
| </named-query> |
| |
| <named-query name="Auction.open"> |
| <query>SELECT a FROM Auction a where a.sold = false</query> |
| </named-query> |
| |
| <named-query name="Auction.photo"> |
| <query>SELECT a.image FROM Auction a where a.id = :auctionId</query> |
| </named-query> |
| |
| <named-query name="Bid.All"> |
| <query>SELECT b FROM Bid b ORDER BY b.time</query> |
| </named-query> |
| |
| <named-query name="Bid.forAuctionId"> |
| <query>SELECT b FROM Bid b WHERE b.auction.id =:auctionId ORDER BY b.time</query> |
| </named-query> |
| |
| <named-query name="Bid.maxForAuctionId"> |
| <query>SELECT MAX(b.amount) FROM Bid b WHERE b.auction.id =:auctionId</query> |
| </named-query> |
| |
| <named-query name="Bid.forUserId"> |
| <query>SELECT b FROM Bid b WHERE b.user.id =:userId ORDER BY b.time</query> |
| </named-query> |
| |
| <named-query name="User.all"> |
| <query>SELECT u from User u</query> |
| </named-query> |
| |
| <named-query name="User.updateName"> |
| <query>UPDATE User u SET u.name = :name WHERE u.id = :id</query> |
| </named-query> |
| |
| <entity class="User" access="VIRTUAL"> |
| <table name="JPARS_AUCTION_USER" /> |
| <attributes> |
| <id name="id" attribute-type="Integer"> |
| <column name="ID" /> |
| <generated-value/> |
| </id> |
| <basic name="name" attribute-type="String" /> |
| <one-to-one name="address" fetch="EAGER" target-entity="Address"> |
| <join-column name="ADDRESS_ID" referenced-column-name="ID"/> |
| <join-column name="ADDRESS_TYPE" referenced-column-name="TYPE"/> |
| <cascade> |
| <cascade-all/> |
| </cascade> |
| </one-to-one> |
| </attributes> |
| </entity> |
| |
| <entity class="Auction" access="VIRTUAL"> |
| <table name="JPARS_AUCTION_AUCTION" /> |
| <attributes> |
| <id name="id" attribute-type="Integer"> |
| <column name="ID" /> |
| <generated-value/> |
| </id> |
| <basic name="name" attribute-type="String" /> |
| <basic name="image" attribute-type="String"/> |
| <basic name="description" attribute-type="String"/> |
| <basic name="startPrice" attribute-type="Double"/> |
| <basic name="endPrice" attribute-type="Double"/> |
| <basic name="sold" attribute-type="boolean"/> |
| </attributes> |
| </entity> |
| |
| <entity class="Bid" access="VIRTUAL"> |
| <table name="JPARS_AUCTION_BID" /> |
| <attributes> |
| <id name="id" attribute-type="Integer"> |
| <column name="ID" /> |
| <generated-value/> |
| </id> |
| <basic name="amount" attribute-type="Double" /> |
| <basic name="time" attribute-type="Long"/> |
| <one-to-one name="user" fetch="EAGER" target-entity="User"> |
| <join-column name="USER_ID" /> |
| </one-to-one> |
| <one-to-one name="auction" fetch="EAGER" target-entity="Auction"> |
| <join-column name="AUCTION_ID" /> |
| <cascade> |
| <cascade-all/> |
| </cascade> |
| <private-owned/> |
| </one-to-one> |
| </attributes> |
| </entity> |
| |
| <entity class="Address" access="VIRTUAL"> |
| <table name="JPARS_AUCTION_ADDRESS" /> |
| <id-class class="org.eclipse.persistence.jpars.test.model.dynamic.AddressPK"/> |
| <attributes> |
| <id name="id" attribute-type="Integer"> |
| <column name="ID" /> |
| <generated-value/> |
| </id> |
| <id name="type" attribute-type="java.lang.String" /> |
| <basic name="city" attribute-type="java.lang.String"/> |
| <basic name="street" attribute-type="java.lang.String"/> |
| <basic name="postalCode" attribute-type="java.lang.String"/> |
| <one-to-one name="user" fetch="EAGER" target-entity="User" mapped-by="address"/> |
| </attributes> |
| </entity> |
| |
| </entity-mappings> |