eclipselink

Spring + JPA: object does not get fetched from the database

余生颓废 提交于 2019-12-08 05:18:40
问题 I am implementing an online shop. I have the following code for saving an order: @Service @Transactional public class OrderServiceImpl extends GenericServiceImpl<Order, Integer> implements OrderService { @Inject private ItemRepository itemRepository; @Override public void saveOrder(Order order) { this.updateItemsAccordingToOrderedQuantities(order); repository.save(order); } private void updateItemsAccordingToOrderedQuantities(Order order) { List<OrderedItem> orderedItems = order

Multiple writable mappings in JPA?

孤者浪人 提交于 2019-12-08 04:57:28
问题 I would like to make a review about some user at my system, this review is made by others users. So here it's my user's table: And this is my user_review table: The EclipseLink is generating like this (actually it insted of @PrimaryJoinColumn was @JoinColumn it change it because of this post ): @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; @Temporal(TemporalType.DATE) private Date date; private String review; //bi-directional many-to-one association to User //

javax.ejb.TransactionRolledbackLocalException (Glassfish 3 + JPA + EclipseLink)

风格不统一 提交于 2019-12-08 04:45:00
问题 I've got a problem on an application developed using Glassfish 3.1.2 + JPA + EclipseLink + MySQL, Immediately after i deploy the application (No tables on DB) it runs just fine and apparently executes the only query (Count entities in table) that i entered. But if i reload the page, calling the servlet again causes an exception to be thrown: TransactionRolledbackLocalException Apparently on the same method used to count entities. Then if i reload again, it runs just fine, then again exception

JPA entity giving error on implementing Bill of material concept

谁说我不能喝 提交于 2019-12-08 04:32:30
问题 Trying to implement the Bill of Material concept using JPA entity:- IDE: Eclipse Helios; Jars: eclipselink2.4.0 , javax.persistence Entity is as follows: @Id @TableGenerator(name = "Config_Key_Incrementor", table = "id_generator", pkColumnName = "gen_name", valueColumnName = "gen_value", pkColumnValue = "conifg_id_gen", allocationSize = 1, initialValue = 1) @GeneratedValue(strategy = TABLE, generator = "Config_Key_Incrementor") @Column(name = "config_id") private int configId; @Column(name =

EclipseLink deserializes an empty entity object on remote EJB call

﹥>﹥吖頭↗ 提交于 2019-12-08 04:14:20
问题 I am using the current release of GlassFish 4.1 with EclipseLink version 2.5.2 included. At this GlassFish, I have an enterprise application and a web application deployed. If an EJB that returns a loaded entity, is called from outside the GlassFish (like an external JavaFX application), the entity is returned properly. But if the same EJB is called from the web application, the entity is not returned properly due to this bug GLASSFISH-17432. The workaround I already found here Calling Remote

Execute some arbitrary sql in the current transaction in JPA 2.0

情到浓时终转凉″ 提交于 2019-12-08 03:31:12
问题 I am new to JPA 2.0/EclipseLink/Glassfish/JEE6, and have kind of a basic question. I have a DAO in which most of the entities are mapped directly to columns using JPA annotations, so I use the EntityManager, and it works great with no issues. However there are some tables in which I am constructing the SQL statements myself b/c they use oracle-specific functions (spatial), and I want very fine-grained control of the SQL. So I am building it with string concatenation. I would like to be able

Make use of @XmlValue in subclass

若如初见. 提交于 2019-12-08 02:53:26
I had this code working fine with EclipseLink 2.5.2, but moving to 2.6.0 breaks the XmlValue annotation: The property or field value cannot be annotated with XmlValue since it is a subclass of another XML-bound class. Base class look like this: public abstract class Baseclass { @XmlAttribute private String baseValue; // ... } One of two subclasses (composite pattern, class B can have a list of BaseClass elements): @XmlRootElement(name = "A") public class A extends BaseClass { @XmlValue private String aValue; } And the usage: public class Root { @XmlElements({ @XmlElement(class = A.class),

How to use EntityManager from @PrePersist?

折月煮酒 提交于 2019-12-08 02:20:37
问题 I have "post" entity/table with this "schema": @Id @GeneratedValue(strategy = GenerationType.AUTO) int id; @GeneratedValue(strategy = GenerationType.AUTO) private Integer postId; private Integer revisionId; private Boolean isCurrentRevision; So, table contains posts, each of them has multiple revisions, but only of them (for each post) is current. Now, let's say I want to persist another revision of existing post (i.e. update post): I need to find highest existing revisionId for this postId,

Glassfish: Silently ignore unavailable data source at application start up

自作多情 提交于 2019-12-08 02:15:37
问题 I have an EJB application which uses JPA 2.0 on Glassfish 3.1.2 (provider is EclipseLink). When the database is down the application does not start and even more: can't be deployed. This is because EclipseLink does some initial verification. Is there a way that the application can be deloyed and started even if the database is down? Background: The resource being unavailable comes not into play until the first business function is called which accesses the database. From application startup

With MOXy and XPath, is it possible to unmarshal two lists of attributes?

大城市里の小女人 提交于 2019-12-08 01:38:40
问题 Note, this is not a duplicate of another question I asked, "With MOXy and XPath, is it possible to unmarshal a list of attributes?" It's similar, but not the same. I've got XML that looks like this: <test> <items> <item type="cookie" brand="oreo">cookie</item> <item type="crackers" brand="ritz">crackers</item> </items> </test> This is similar to the xml in my earlier question except now there are two attributes per item instead of one. In my class: @XmlPath("items/item/@type") @XmlAttribute