Skip to content
Advertisement

Tag: hibernate

Which collections are supported by Hibernate @ManyToMany annotation

I used @ManyToMany annotation on a Set and it worked fine. When I used ArrayList instead of Set it throws exception: org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: com.kaushik.winnersoft.data.Student.enrolledCourses Is ArrayList not supported? Which all collection are supported by @ManyToMany annotation? Answer The supported interfaces are: You get the exception because you have

How to create a generic DAO for CRUD methods

I’m trying to create a generic DAO for the basic CRUD methods so that I can reuse the code, but I really have no clue how to start. I already have a DAO for every class, and they work perfectly. I read lots of tutorial, and downloaded projects, but I can’t adapt (or understand) it to my program. Here is

Hibernate upgrade to 5.2 – Session Factory creation and replacing PersistentClass for getting entity class properties

I am currently upgrading my Hibernate version to the latest version 5.2.10. I replaced my code in the HibernateUtil for the SessionFactory creation. 4.3.11.Final (Previous): 5.2.10 Final (New): Now I have a method which would fetch me the list of column names by passing the DB table name as a string. I did it like this before in 4.3.11.Final: Now

How to reset Hibernate sequence generators?

I’m using Hibernate 3.5.6-Final with an Oracle database for production and a H2 database for integration tests. The Hibernate mapping for ID creation looks like this with every entity extending EasyPersistentObject: Before each JUnit integration test I am removing all data from the database with Everything works fine until I increment the allocationSize for sequence generation. Raising this to e.g.

Where can I find documentation for Hibernate’s legacy hbm.xml mapping files?

I have joined a new team, and their project is using pretty much exclusively legacy-style Hibernate Mapping files (*.hbm.xml) for their Hibernate set-up. The current documentation pretty much seems to restrict itself to mention that Hibernate still supports hbm files and that they will take precedence over annotations. Can someone please provide a link to documentation that mainly deals with

Java Hibernate @SafeHtml not allows url links

I need to have XSS filter in my textfield, but i need to allow certain html tags for text formatting (bold, italic, etc), and i also need to allow url links like: So in my entity class i added whitelist: But it still gives me the following error: Answer You have two problems one is that style attribute is not

Advertisement