AnnotationConfiguration « Map « JPA Q&A





1. EJB3 CMP + programmatic configuration of Hibernate AnnotationConfiguration    stackoverflow.com

I use EJB3 container managed persistence i.e an EntityManager is injected via @PersistenceContext annotation. The persistent context then may be propagated to nested EJBs. Transactions are also managed by the contaner ...

2. Hibernate - AnnotationConfiguration deprecated    stackoverflow.com

I am using Hibernate in version 3.6.0 and the AnnotationConfiguration is marked as deprecated. Here is the the line in my HibernateUtil.java class:

sessionFactory = new AnnotationConfiguration().configure("/hib.cfg.xml").buildSessionFactory();
What's the replacement for AnnotationConfiguration? Best Regards Tim. ...

3. Where should I put the call to the Hibernate annotationConfiguration() to this be called only once?    stackoverflow.com

I have in my web application some java beans (EJB 3.1) that make use of Hibernate SessionFactory and therefore I need to centralize the creation of this object since I just ...

4. Unknown entity problem in Hibernate with AnnotationConfiguration    stackoverflow.com

I've been googling for this problem from last 2 days but havent found any proper solution. I am developing a desktop application with Hibernate. I am using AnnotationConfiguration for registering entities ...

5. Hibernate: An AnnotationConfiguration instance is required to use ... error    stackoverflow.com

I build my HibernateUtil this way :

public class HibernateUtil {

        private static final SessionFactory sessionFactory;

        static {
 ...

6. NoSuchMethodError: AnnotationConfiguration.setProperty    forum.hibernate.org

I added a testNG test very similar to EJB3IntegrationTest CaveatEmptor-JPA Hibernate sample to my current project. It's not a smooth ride. Finally, I still get the following error (ANT testng task output). Hibernate version are as the followings: Hibernate-core: 3.2 Hibernate-annotation: 3.3 Hibernate-entitymanager: 3.3.2 Hibernate-validator: 3.0.0. I do see org.hibernate.cfg.AnnotationConfiguration.setProperty(Ljava/lang/String;Ljava/lang/String;) in the Javadoc. Appreciate if somebody can help. Code: [testng] 13:11:42,634 ...

7. AnnotationConfiguration Null pointer Exception    forum.hibernate.org

Hi, Its looks simple but strange and not able to find why this null pointer exception when making AnnotationConfiguration object. FirstExample.java ============= package roseindia.tutorial.hibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.AnnotationConfiguration; public class FirstExample { public static void main(String[] args) { Session session = null; try{ System.out.println("before annotation"); AnnotationConfiguration cfg=new AnnotationConfiguration(); System.out.println("after annotation"); SessionFactory sessionFactory =cfg.configure().buildSessionFactory(); session =sessionFactory.openSession(); //Create new ...

8. [SOLVED] AnnotationConfiguration to use persistence.xml    forum.hibernate.org

Hello ... I was wondering if anyone knows a way to use the AnnotationConfiguration class in a manner that makes it use the persistence.xml file instead of the hibernate.cfg.xml file. I'm doing an app that does not use JBoss Seam or Struts or Spring or anything. I'm just using a servlet (pretty bare bones I know) to do this: Code: ...

9. AnnotationConfiguration, could not save/update data    forum.hibernate.org

public class UserDAO { private Session sess; public UserDAO() { AnnotationConfiguration ac = new AnnotationConfiguration(); ac.addAnnotatedClass(User.class); sess = ac.configure().openSession(); } public void saveOrUpdate(User user, String name) { user.setName(name); sess.saveOrUpdate(user); ...





10. Error while initting AnnotationConfiguration    forum.hibernate.org

Newbie Joined: Tue Jul 27, 2010 11:48 am Posts: 1 Hi all :) I'm having some issues getting Hibernate Annotations to work with my Vaadin project. I have the feeling it has something to do with my use of maven, as the error I get seems to come from the bytecode inserter used by Hibernate Annotations. If I try to setup ...

11. Auxillary database-object & AnnotationConfiguration    forum.hibernate.org

...

12. AnnotationConfiguration.setProperties() method broken?    forum.hibernate.org

Hibernate version: hibernate-3.0beta1, hibernate-annotations-3.0alpha1 I am trying to programmatically configure the properties of my AnnotationConfiguration like the following. AnnotationConfiguration ac = new AnnotationConfiguration(); Properties p = new Properties(); p.put("hibernate.dialect", "org.hibernate.dialect.SQLServerDialect"); p.put("hibernate.connection.driver_class", "com.inet.tds.TdsDriver"); p.put("hibernate.connection.url", "jdbc:inetdae7:...?database=..."); p.put("hibernate.connection.username", "..."); p.put("hibernate.connection.password", "..."); p.put("hibernate.show_sql", "true"); ac.setProperties(p); ac.addAnnotatedClass(Item.class); ac.addAnnotatedClass(Person.class); ac.addAnnotatedClass(Reservation.class); ac.addAnnotatedClass(User.class); SessionFactory sf = ac.buildSessionFactory(); However, I'm receiving a stack trace like the following. It appears to ...

13. AnnotationConfiguration    forum.hibernate.org

Hello, as far as i know you have to add your hbm.xml for each of your files, one by one, exactly the same way as when you where using the org.cfg.Configuration class, but also with the AnnotationConfiguration you could add Classes configuration, those Classes must contain the EJB3-Hibernate annotations to be processed. Also if you're using Spring with hibernate you could ...

14. @PrePersist is not fired when using AnnotationConfiguration    forum.hibernate.org

Hello, I have a question about AnnotationConfiguration. I want to configure hiberante through annotations and use @PrePersist and @PreMerge callbacks for entities. I declares class MyEntity: Code: @Entity @Table(name="OBJECTS") public class MyEntity { private Integer objectID; @Id @Column(name="OBJECT_ID") @SequenceGenerator(name="OBJECT_SEQ", sequenceName="OBJECT_SEQ", allocationSize=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, ...

15. NoSuchMethodError: AnnotationConfiguration.getReflectionMana    forum.hibernate.org

Hi, I'm trying to use Hibernate throught the JPA standard (EntityManager). It's a very basic example - using Java SE , default mapping, no relationships. I get the following exception: Code: Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationConfiguration.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager; at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:152) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:186) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:246) at ...

16. AnnotationConfiguration().addPackage(packageName)    forum.hibernate.org

File configFile = new File(hibernateConfigurationFile); SessionFactory sessionFactory = null; if(packageName != null) { System.out.println("Package name: " + packageName); System.out.println("Hibernate configuration file: " + hibernateConfigurationFile); sessionFactory = new AnnotationConfiguration().addPackage(packageName).configure(configFile) .buildSessionFactory(); } else { sessionFactory ...





18. Problem with hibernate AnnotationConfiguration    forum.hibernate.org

Hi all, I have the following in hibernation.cfg.xml file ?xml version='1.0' encoding='utf-8'?> com.mysql.jdbc.Driver jdbc:mysql://mysql.wolfram.com:3324/search_info_tst search_user_tst wrselohetst 10 true org.hibernate.dialect.MySQLDialect update and com.hibernate.Contact.java is as follows import javax.persistence.*; @Entity @Table(name = "test") public ...

20. AnnotationConfiguration/Configuration problem    forum.hibernate.org

Hi, When running the app on OSX 10.5.4 all works great and combining xml mappings and Annotated mappings is no problem. When deployed on FEDORA 2 i686 the below exception occurs however. It seems to point to wrong versioning but I tried a number of combinations that all worked locally and none on fedora. Does anyone have more pointers for us? ...

21. An AnnotationConfiguration instance is required to use<..    forum.hibernate.org

Full stack trace of any exception that occurs: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Initial SessionFactory creation failed.org.hibernate.MappingException: An AnnotationConfiguration instance is required to use Exception in thread "main" java.lang.ExceptionInInitializerError at HibernateExample.utils.HibernateUtil.(HibernateUtil.java:17) at HibernateExample.Main.(Main.java:23) at HibernateExample.Main.main(Main.java:17) Caused by: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use at ...

22. Hibernate 3 with annotationConfiguration export xml data ?    forum.hibernate.org

Hello, I am using Hibernate 3 with a annotation configuration and I wonder if there exists a solution to export the database in xml format that is automatic ? I see the following method : generateSchemaUpdateScript(...) But the data are not contained in this sql line ... How to do ? Do I need a mapping file or other because annotation ...

23. OutOfMemory exception initializing AnnotationConfiguration    forum.hibernate.org

Hi I am new to hibernate, I wrote a simple application to store some objects into the backend mysql database. I used eclipse on windows to test this sample and it was working fine with that. Then in order to make the build/run simpler I wrote the ant file so that I can invoke it from command prompt as well. And ...

24. org.hibernate.MappingException: An AnnotationConfiguration..    forum.hibernate.org

While trying to configure a new project using hibernate I get the following error: Caused by: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use This happens when the code is creating the SessionFactory: sessionFactory = new Configuration().configure().buildSessionFactory(); What is causing this and whats the fix? I'm not using annotations, at least my POJOs are not annotated and I don't ...

25. AnnotationConfiguration method not found    forum.hibernate.org

26. Hanging at AnnotationConfiguration:401 - processing fk mappi    forum.hibernate.org

Hibernate Details : 14:11:19,390 INFO Version:15 - Hibernate Annotations 3.4.0.GA 14:11:19,416 INFO Environment:543 - Hibernate 3.3.1.GA 14:11:19,539 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA During the call to configuration.buildMappings() i am seeing the following in the log : AnnotationConfiguration:401 - processing fk mappings (*ToOne and JoinedSubclass) and it just hangs ? It looks like some sort of infinite loop is being ...