i needed to create the scripts needed to create a database schema for my persistence objects (JPA) using hibernate. there is a bunch of documentation about using specific ant tasks to do this. but as usual, beyond configuring ant with some arcane hibernate tools tasks etc. I found it easier to just do the following […]
Read More getting hibernate to generate sql statements for my database (schema)
Trying to use JPA in OSGI always gives me the error “javax.persistence.PersistenceException: No Persistence provider for EntityManager named …”. Reason: Persistence.createEntityManagerFactory() uses the ClassLoader to load resources. It seems to be the ThreadContext ClassLoader. So in OSGI it fails due to the OSGI classloader tricks. Using the tricks given in http://lsd.luminis.nl/jpa-persistence-in-osgi-with-openjpa/ I got this to work. That […]
Read More OSGI, JPA
playing with JPA, I do several transactions. It seems between the transactions, all the data is always lost from the database. Setting hibernate.hbm2ddl.auto to false seems to solve it. Strange but just give me working code plz..
Read More where does hibernate lose my data?
another set of points -ran into trouble trying to get hibernate to check my 2nd entity that is referencing the first one. the mysql create broke on the wrong innodb syntax noted before. and could not just leave the second one in as i wanted to reference the first one. solution. org.hibernate.dialect.MySQL5InnoDBDialect is a correct dialect […]
Read More hiiiibernateee
forgot to add the entity class to the hibernate configuration as an annotatedclass (configuration.addAnnotatedClass(..))
Read More org.hibernate.MappingException: Unknown entity
the hibernate docs tell me to create my entity classes with a no-args constructor. so what if i add a constructor with all parameters and also set the object property tagged as the hibernate id? well, it works fine. the value i pass for the id is ignored and hibernate overwrites it with a generated […]
Read More hibernate and constructors with arguments
notes to self, -JPA is the standard java annotation thingy for hibernate type things -hibernate reference document lists nicely all configuration options. to get a list of relevant ones to set better to google for tutorial for hibernate and that db, then check the docs for what the options are. -“hibernate.hbm2ddl.auto”, “create” leads to breaking […]
Read More some hibernate twinkies
well, now i got another error along the lines of check the manual that corresponds to your MySQL server version for the right syntax to use near ‘type=InnoDB’ –>hibernate generates a script that is wrong in defining “type=” where it should be “engine=”. whooppee so it seems i can only create the tables myself..
Read More another fix to hibernate error