java ee - JPA and order of columns in the database -


i'm using eclipselink persistence provider. there way specify order in columns appear in database? column-order in database doesn't match attribute-order in entities. far i've understood hibernate order columns alphabetically can't find specifications eclipselink.

eclipselink sorts mappings , columns based on weight of mapping. weight not set other ensure baisc mappings first, , relationship mappings second.

you can set weight mapping if desire using descriptorcustomizer. set descriptor not order mapping weight, order specified used (setshouldordermappings(false)).

public void mycustomizer implements descriptorcustomizer {   public void customize(classdescriptor descriptor) {     descriptor.getmappingforattributename("name").setweight(2);   } } 

there have been recent changes weighting of mappings in 2.2 development, mappings sorted name within same weight levels.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -