CollectionOfElements « Map « JPA Q&A





1. @CollectionOfElements without create the apposite table    stackoverflow.com

EDIT Hi all. WHAT I TRY TO GET I want a table that represents a list of personal details, this table is called PERSON and must have this columns:

ID      ...

2. Deleting JPA entity containing @CollectionOfElements throws ConstraintViolationException    stackoverflow.com

I'm trying to delete entities which contain lists of Integer, and I'm getting ConstraintViolationExceptions because of the foreign key on the table generated to hold the integers. It appears that the ...

3. Hibernate Null values for @CollectionOfElements    stackoverflow.com

I'm mapping a set of attributes to my entity using @CollectionOfElements. The goal here is to be able to provide a meta data list that can be used in a query ...

4. Hibernate @CollectionOfElements Annotation for internationalisation    stackoverflow.com

Does anyone know of a good example (on the net) of how to use the @collectrionOfElements annotations in Hibernate. I have existing model objects and I need to internationalize a few ...

5. hibernate @CollectionOfElements not persisted    stackoverflow.com

HI, I am using Hibernate with plenty of satisfaction so far. Lately it seems that I am not able to persist a @CollectionOfElements using annotation. I am saving an object of class Estate ...

6. Hibernate @CollectionOfElements and @Parent    stackoverflow.com

I've done the following mapping:

@Entity
@Table(name = "NWS_NEWS")
public class News implements Serializable {

    private static final long serialVersionUID = 5246618151933389186L;

    private String id;
    ...

7. @CollectionOfElements trouble    forum.hibernate.org

public class Employee implements Serializable{ @Id@GeneratedValue @Column(name="OBJECTID") private Long objectId; @Column (name="FIRST_NAME") private String firstName; @Column(name="LAST_NAME") private String lastName; @ManyToOne (cascade={CascadeType.PERSIST, CascadeType.MERGE}) @JoinColumn (name="LOCATION") private Location location; ...

9. @CollectionOfElements and jointable    forum.hibernate.org

@Entity public class Municipality implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; private String country; private String province; private String name; @Column(name="cod_catasto") ...





10. @CollectionOfElements NoSuchMethodError in 3.2.0.cr2    forum.hibernate.org

Caused by: java.lang.NoSuchMethodError: org.hibernate.cfg.NamingStrategy.collectionTableName(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; at org.hibernate.cfg.annotations.TableBinder.bind(TableBinder.java:90) at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:769) at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:442) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:403) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35) ...

11. @CollectionOfElements and @OnDelete    forum.hibernate.org

Is there any way to configure a @CollectionOfElements association so that SchemaExport will generate "on delete cascade" for the FK constraint on the associated table? For example: @CollectionOfElements @JoinTable( name="multistring_values", joinColumns = @JoinColumn(name="attributeid") ) @Column(name="stringvalue", length=2048) @OnDelete(action=OnDeleteAction.CASCADE) public Set getValue() { return this.value; } This results in "only inverse one-to-many associations may use on-delete="cascade"" error message. Ideally I want the associated ...

12. @CollectionOfElements annotation problem    forum.hibernate.org

Hibernate version: 3.2.1 Name and version of the database you are using: MSSQL server 2005 Hello All, I have a simple entity called StaticStringDatasource. In this entity I have a list of string values which I want to save to a database. I used the collections annotation to do it. Code: @Entity @Table(name = "Datasources_StaticString") public class StaticStringDatasource extends Datasource { ...

13. Deleting an element from a @CollectionOfElements    forum.hibernate.org

org.hibernate.SQL - delete from User_category where User_id=? and categories_index=? org.hibernate.SQL - update User_category set categories_id=? where User_id=? and categories_index=? org.hibernate.util.JDBCExceptionReporter - failed batch org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)

14. @CollectionOfElements and HashMap trouble cont'd    forum.hibernate.org

I'm sorry to be a bother, since I already asked a similar question here http://forum.hibernate.org/viewtopic.php?t=981118&highlight=collectionofelements, but I haven't solved that problem yet. I noticed that I can map a HashMap to the MySQL database with Varchar(255) values if I use this mapping: Code: @CollectionOfElements public Map getSettings() { return settings; } The table will ...

15. @CollectionOfElements with enum does not work    forum.hibernate.org

Hello! I want to use @CollectionOfElements with an enum-Type. I tried this example: Code: @Entity @Table(name = "t_person") public class Person { @Id @Column(name = "person_id") @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private Set characters ; ...

16. @CollectionOfElements with enum and HQL/criteriea    forum.hibernate.org

Hi ! Here is my mapping: @Entity public class Contact { public enum TypeSynthese {one, two, three}; @CollectionOfElements @JoinTable(name="contact_synthese", joinColumns = @JoinColumn(name="contact_id")) @Column(name="synthese_id", nullable=false) @Enumerated(EnumType.STRING) private Set syntheses; } I would like to select all contacts which syntheses' Collection contains two. from Contact c where c.syntheses = two doesn't work. from Contact c where two in (c.syntheses) doesn't work either. from ...





17. Does the MAP of @CollectionOfElements not allow null value?    forum.hibernate.org

@Entity @Table(name = "NEWS") class NewsVO { @Id @Column(name = "NEWS_ID") private long newsId; @CollectionOfElements @JoinTable(name = "NEWS_PHOTO_DESC", joinColumns = { @JoinColumn(name = "NEWS_ID") }) @MapKey(columns = { @Column(name = "PHOTO_ID") }) @Column(name = "DESCRIPTION") private Map photos = new HashMap(); ..... ...

18. Updating @CollectionOfElements not deleting old value    forum.hibernate.org

@Entity @Table(name="AD_ACTION") public class AdAction extends PersistentEntity { private long adActionID; @Id @Column(name = "AD_ACTION_ID") @SequenceGenerator(name = "s1", sequenceName = "CMS_SEQUENCE") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "s1") public long getAdActionID() { ...

19. SELECT then DELETE then INSERT with @CollectionOfElements    forum.hibernate.org

Hi I have entity with a @CollectionOfElements-field. When I run a query (using a regular query.getResultList()), hibernate first does a SELECT on both tables, then DELETEs all the rows in the JoinTable and then INSERTS the same rows! What's going on here? Any ideas....? thanks! Entity: Code: @Entity @NamedQuery( name="findUserByEmail", ...