[Persistence, JBoss/CMP, Hibernate, Database] - Persisting
by jactor
I recently put this in the EJB forum and later discovered that this is where it should be:
I am trying to develop a entity which extends another entity and which use the annotation @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS), but this only provides an exception as the sub class does not have an @Id annotated:
org.hibernate.MappingException: Cannot use identity column key generation with <union-subclass> mapping for: concept.entity.Entity
However: If I do annotate this @Id, I get this one:
org.hibernate.AnnotationException: Unable to define/override @Id(s) on a subclass: concept.entity.En
| tity
Suggestions?
I had the idea that @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) would give a new table with every field from the sub classes and mother class in this table. I searched the final draft on persistence for this notation but I came up with no suitable instances found.
Is this assumption of the strategy correct or (especially since this is not working) is it another way of doing this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959842#3959842
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959842
19 years, 9 months
[Persistence, JBoss/CMP, Hibernate, Database] - Hibernate 2nd level cache update problem
by magicmac
Hey,
I'm trying to use some 2nd level caching in Hibernate, TreeCache in particular, but the problem seems to concern any cache provider.
Here is simplified algorithm of what is going on:
for i=0..100
Transaction.begin (JTA or Hib)
hibernateTemplate.load()
//some business logic that updates the loaded entity
hibTemplate.update()
Transaction.commit()
In first iteration, load searches the cache and it misses for the first time. Db fetch. Saved into cache. Sool. And here comes the update. The entity has changed meanwhile (i.e. some counter increased). Unfortunatelly update doesn;t update in cache, but instead issues db updates:(
Any subsequent iteration gets entity from cache, but its stale (still the one that was stored in first iteration after cache miss-hit)
What's the magic about that updating in cache?
Some conf details:
-hib3
- (for TreeCache) in entity mapping
-jotm as jta transaction manager
-treecache.xml with some slight changes, but default one behaves same way
I dont really think it;s a conf problem, I guess it;s rather my misunderstanding of 2nd level caching or wrong approach, I dont know. Logically, I really think it should do the update in cache instead of db, especially in case of fully transactional cache like TreeCache. The db update should follow the eviction policy of the cache.
Well I will appreciate any explaination and help
Thanks
M.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959840#3959840
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959840
19 years, 9 months
[Persistence, JBoss/CMP, Hibernate, Database] - How to configure batch/fetch size
by qbacomarch
Hi,
Recently I wrote a simple application (EJB3.0), which reads all rows of one unrelated table.
My problem is that I want to set batch (or fetch - i don't know which term is appropriate) size. As I look at the session trace in oracle 10g, i get, thath it is fetching the data in 10-row packs (73 rows, 8 fetches) . However, during the deployment, I get this message form JBoss:
INFO [SettingsFactory] JDBC batch size: 15
How can I change that size? It would be great if there is some way to change it for this specific app. I was trying to find out, if there's any way to do this by configuring the persistence.xml, but i couldn't find any docs about it.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959835#3959835
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959835
19 years, 9 months