[hibernate-issues] [Hibernate-JIRA] Resolved: (ANN-635) Hib doesn't share allocated sequence values between different classes

Emmanuel Bernard (JIRA) noreply at atlassian.com
Tue Jul 17 10:29:52 EDT 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-635?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bernard resolved ANN-635.
----------------------------------

    Resolution: Won't Fix

This is how it is expected. If you want the behavior you describe write your own IndentifierGenerator and use @GenericGenerator

> Hib doesn't share allocated sequence values between different classes
> ---------------------------------------------------------------------
>
>                 Key: ANN-635
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-635
>             Project: Hibernate Annotations
>          Issue Type: Improvement
>    Affects Versions: 3.3.0.ga
>            Reporter: Adam Wozniak
>         Attachments: Zbbb.java, Zccc.java
>
>
> Hello Everybody
> This is my first issue here, so I don't know if my issue will be classified as a bug or an improvement only.
> My config:
> hibernate-3.2.4.sp1
> hibernate-annotations-3.3.0.GA
> hibernate-entitymanager-3.3.1.GA
> I use Oracle database. I have 2 entity classes (Zbbb and Zccc).
> Those 2 classes map two database table: ZBBB and ZCCC.
> Both tables have identical structure:
> ID - NUMBER (primary key)
> TEXT - VARCHAR2(10)
> Identifiers for both tables are generated by _ONE_ (the same) Oracle sequence.
> For both entities I have following annotations:
> 	@Id
> 	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "my_generator")
> 	@javax.persistence.SequenceGenerator(
> 		  name = "my_generator"
> 		, sequenceName = "SEQ_DEPT"
> 		, allocationSize=2)
> Note, that allocationSize is set: 2.
> When I am creating and persisting 2 Zbbb and 2 Zccc entities like this:
> 	{ Zccc entity = new Zccc(); em.persist(entity); } // DB HIT!
> 	{ Zccc entity = new Zccc(); em.persist(entity); }
> 	{ Zbbb entity = new Zbbb(); em.persist(entity); } // DB HIT!
> 	{ Zbbb entity = new Zbbb(); em.persist(entity); }
> ... everything is OK because I have 2 hits to database sequence only.
> But when I am creating and persisting 1 Zbbb and 3 Zccc entities like this:
> 	{ Zbbb entity = new Zbbb(); em.persist(entity); }
> 	{ Zccc entity = new Zccc(); em.persist(entity); }
> 	{ Zccc entity = new Zccc(); em.persist(entity); }
> 	{ Zccc entity = new Zccc(); em.persist(entity); }
> ... I have 3 hits do database sequence.
> I would expect, that Hibernate should recognize that Zbbb and Zccc are suing the same database sequence and should share all cached values between entities of those two classes.
> Do I do something wrong?
> Kind regards,
> Adam Wozniak

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list