Wiki source code of R130200001XWIKI18429
Last modified by Thomas Mortagne on 2021/11/09 14:44
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{groovy}} | ||
2 | import java.sql.Connection; | ||
3 | import java.sql.DatabaseMetaData; | ||
4 | import java.sql.ResultSet; | ||
5 | import java.sql.SQLException; | ||
6 | import java.util.Iterator; | ||
7 | import java.util.List; | ||
8 | |||
9 | import javax.inject.Inject; | ||
10 | import javax.inject.Named; | ||
11 | import javax.inject.Singleton; | ||
12 | |||
13 | import org.apache.commons.lang3.StringUtils; | ||
14 | import org.apache.commons.lang3.exception.ExceptionUtils; | ||
15 | import org.hibernate.HibernateException; | ||
16 | import org.hibernate.Session; | ||
17 | import org.hibernate.boot.Metadata; | ||
18 | import org.hibernate.dialect.Dialect; | ||
19 | import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess; | ||
20 | import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; | ||
21 | import org.hibernate.engine.spi.SessionImplementor; | ||
22 | import org.hibernate.mapping.Collection; | ||
23 | import org.hibernate.mapping.Column; | ||
24 | import org.hibernate.mapping.PersistentClass; | ||
25 | import org.hibernate.mapping.Property; | ||
26 | import org.hibernate.mapping.Selectable; | ||
27 | import org.hibernate.mapping.Table; | ||
28 | import org.hibernate.mapping.Value; | ||
29 | import org.hibernate.query.NativeQuery; | ||
30 | import org.slf4j.Logger; | ||
31 | import org.xwiki.component.annotation.Component; | ||
32 | import org.xwiki.extension.version.Version; | ||
33 | import org.xwiki.extension.version.internal.DefaultVersion; | ||
34 | |||
35 | import com.xpn.xwiki.XWikiException; | ||
36 | import com.xpn.xwiki.doc.DeletedAttachment; | ||
37 | import com.xpn.xwiki.doc.XWikiDeletedDocument; | ||
38 | import com.xpn.xwiki.internal.store.hibernate.HibernateStore; | ||
39 | import com.xpn.xwiki.store.DatabaseProduct; | ||
40 | import com.xpn.xwiki.store.XWikiHibernateBaseStore.HibernateCallback; | ||
41 | import com.xpn.xwiki.store.migration.DataMigrationException; | ||
42 | import com.xpn.xwiki.store.migration.XWikiDBVersion; | ||
43 | |||
44 | |||
45 | migration = services.component.getInstance(com.xpn.xwiki.store.migration.hibernate.HibernateDataMigration, 'R130200001XWIKI18429') | ||
46 | hibernateStore = services.component.getInstance(com.xpn.xwiki.internal.store.hibernate.HibernateStore) | ||
47 | |||
48 | metadata = hibernateStore.getConfigurationMetadata() | ||
49 | for (def entity : metadata.getEntityBindings()) { | ||
50 | print "* $entity" | ||
51 | print " " | ||
52 | println hibernateStore.getConfiguredTableName(entity) | ||
53 | |||
54 | for (Iterator<Property> it = entity.getDirectSubclasses(); it.hasNext();) { | ||
55 | println "** ${it.next()}" | ||
56 | } | ||
57 | |||
58 | for (Iterator<Property> it = entity.getPropertyIterator(); it.hasNext();) { | ||
59 | println "** ${it.next()}" | ||
60 | } | ||
61 | } | ||
62 | |||
63 | println migration.getRowFormat('xwikilistitems') | ||
64 | |||
65 | java.lang.StringBuilder builder = new java.lang.StringBuilder(); | ||
66 | |||
67 | //migration.setTableDYNAMIC | ||
68 | |||
69 | println builder; | ||
70 | |||
71 | println migration.getPreHibernateLiquibaseChangeLog().replace('<sql>', '\n<sql>') | ||
72 | {{/groovy}} |