-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Persisting Change In IndexColumn
PostPosted: Wed Jun 11, 2008 5:56 am 
Beginner
Beginner

Joined: Tue Jul 04, 2006 11:29 am
Posts: 20
Location: Cambs, UK
Hi all,

Got a simple problem that I can't seem to get to work and I just was wondering if someone could let me know if I'm persisting the right thing. I have two classes: Store & Field. Below is an extremely cut down version of the class with the items I'm having trouble with

Code:
class Store {
  @OneToMany(fetch = FetchType.LAZY)
  @JoinColumn(name = "STORE_ID", nullable = false, updatable = false)
  @org.hibernate.annotations.ForeignKey(name = "FK_FIELD_STORE_ID")
  @org.hibernate.annotations.IndexColumn(name = "FIELD_POSITION", nullable = false)
  private List<Field> fields = new LinkedList<Field>();

  // And then the rest of it
}

class Field {
  // Various properties
}


Now I want to change the order of the fields related to my store so I'm doing something like below:

Code:
List<Field> results = store.getFields();
// Do something to change the order of fields
storeDAO.persist(store);  // Calls a persist and flush on my entitymanager


But for some reason, the persist doesn't do anything. I could add something else in that code above like store.setName() and that will persist fine. It just doesn't change the order of the index column.

Anyone got any clue what I'm doing wrong? I can add more info if it's needed but hopefully that simple explanation will be enough.

Cheers,
Lee


Hibernate version: 3.2.6
Name and version of the database you are using: MySQL 5


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.