Questions tagged [embeddable]

@Embeddable is an annotation used in Java to suggest that a class is stored as an intrinsic part of an owning entity and share the identity of the entity. It is a part of JPA implementations.

@Embeddable is an annotation used in to suggest that a class is stored as an intrinsic part of an owning entity and share the identity of the entity. It is a part of implementations/frameworks such as . This annotation will suggest to the framework that the class is a part of another entity and will treat any mapped attribute within the class as a mapped attribute of the containing entity.

It corresponds to other annotations which may be used by the owning Entity such as @Embedded and @Entity.

Java EE Documentation

SO question covering the basics of Embeddable

141 questions
39
votes
5 answers

Can I make an embedded Hibernate entity non-nullable?

What I want: @Embedded(nullable = false) private Direito direito; However, as you know there's no such attribute to @Embeddable. Is there a correct way to do this? I don't want workarounds.
André Chalella
  • 13,788
  • 10
  • 54
  • 62
31
votes
2 answers

Hibernate @Embeddable class which extends another @Embeddable class, Properties not found for @OneToMany mapping

We are translating old xml based configuration to Annotation based configuration Situation There is a class which is annotated as @Embeddable(ParentPk.java), another class extends this class which is @Embeddable(ChildPk.java), this ChildPk.java is…
Yahya Arshad
  • 1,626
  • 2
  • 19
  • 34
28
votes
12 answers

hibernate h2 embeddable list expected "identifier"

I'm trying to associate a list of function (whom Embeddable) within my Employee Entity and H2 seems unhappy with this saying that it expected an "identifier" Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement " CREATE…
Nicolas Sagala Beaucage
  • 1,229
  • 1
  • 11
  • 23
26
votes
1 answer

Nested embeddable - AttributeOverride for embeddable within embeddable

I have class Money which is an @Embeddable @Embeddable public class Money implements Serializable, Comparable { @Column(name = "amount", precision = 15, scale = 2) private BigDecimal amount; } When I useit multiple time inside…
Pawel Szulc
  • 1,041
  • 2
  • 12
  • 19
23
votes
4 answers

Java ETL: hard to find a suitable one

I'm looking for an embeddable Java ETL, i.e., an Extract Transform Load engine that can be called from Java code. I'm finding it surprisingly hard to find a suitable one. I'm mainly looking at loading delimited text files into database tables,…
tpdi
  • 34,554
  • 11
  • 80
  • 120
19
votes
1 answer

Set Embeddable Field as Primary Key from Parent Entity Mapping - Doctrine2

TLDR; Doctrine2: I need to know if it is possible to make a field within an Embeddable into a Primary Key from the Parent Entities (or MappedSuperclass') mapping. I already know how to set the primary key from the Embeddable's mapping, but this is…
Ben
  • 191
  • 5
17
votes
4 answers

@Embedded object not instantiated automatically if it has no basic datatype fields

Fundamental question: Why aren't @Embedded objects always instantiated? The interesting observation is that Ebean does not instantiate @Embedded objects if those do not contain basic datatypes (int, boolean...) or weren't touched before.…
allprog
  • 16,540
  • 9
  • 56
  • 97
15
votes
1 answer

Embeddable and ElementCollection nesting

I have fairly typical scenario where there is a main @Entity and everything inside him is embeddable (so everything inside doesn't make sense without the parent). Now JPA 2.0 is blocking me to nest a @ElementCollection inside a @Embeddable defined…
Francesco
  • 857
  • 1
  • 11
  • 26
14
votes
2 answers

JPA / Hibernate OneToMany Mapping, using a composite PrimaryKey

I'm currently struggling with the right mapping annotations for a scenario using a composite Primary Key Class. First, what I am trying to achieve in words: I have 2 classes: group and FieldAccessRule. A Group can have many FieldAccessRules, while a…
dognose
  • 20,360
  • 9
  • 61
  • 107
14
votes
1 answer

Foreign key mapping inside Embeddable class

I am using eclipselink for JPA. I have an entity, which has a composite key fabricated out of two fields. Following is my Embeddable primary key class' fields(members). @Embeddable public class LeavePK { @ManyToOne(optional = false) …
Ahamed
  • 39,245
  • 13
  • 40
  • 68
13
votes
1 answer

JPA SubGraph to define fetchtype of an embedded property

I have an entity Ride which embeds an embeddable "entity" Route. Route has a List property towns with ManyToMany relation, so it has fetchtype LAZY (and I don't want to use EAGER). So I want to define an NamedEntityGraph for the entity Ride, to load…
user3909622
9
votes
1 answer

Hibernate Embedded/Embeddable not null exception

In the owning class: ... @Embedded private LatLon location; ... In the referenced class: @Embeddable public class LatLon implements Serializable { private double lat; private double lon; ... } When I try to save an instance of the…
Finbarr
  • 31,350
  • 13
  • 63
  • 94
7
votes
2 answers

In need of an embeddable NoSQL database that handles ~1Gb datasets, persisted on disk

I am building an Electron app, for which I need to select an embeddable NoSQL database. In fact, this database is supposed to hold a local subset of data stored on an ArangoDB remote backend. I have been searching the Internet a lot, but fail so far…
Willem van Gerven
  • 1,407
  • 1
  • 17
  • 24
7
votes
2 answers

Youtube video not embeddable but API says it is

I want to detect whether a video is playable or not outside from Youtube. I am currently detecting copyright infringement, embeddable and "syndicatable" restrictions. I am calling twice the API, once in version 3 and once in version 2 with…
qschulz
  • 1,543
  • 1
  • 9
  • 10
6
votes
1 answer

How to build my own embeddable audio player // not pure flash

We are currently developing a community based on user-generated audio content. The base technology for playing audio will be Soundmanager 2 is HTML5. We created our own player interface based on the SM2 options jQuery. In order to make the uploaded…
Mateng
  • 3,742
  • 5
  • 37
  • 64
1
2 3
9 10