Skip to content
Permalink
Browse files
JUDDI-1016 produces DDL for all known supported hbernate dialetcs, re…
…solves relative path class path issues
  • Loading branch information
spyhunter99 committed Aug 13, 2020
1 parent 40b402d commit 9627e3c76d1a5354063a6d5c83dea8edac744c11
Showing 1 changed file with 18 additions and 6 deletions.
@@ -58,8 +58,13 @@ public App() {

//initial from the current class path
private void initialJpsClassList(String packageName) throws Exception {

List<Class> classesForPackage = getClassesForPackage(Package.getPackage(packageName));
Package pk = Package.getPackage(packageName);
List<Class> classesForPackage = new ArrayList<>();
if (pk != null) {
classesForPackage.addAll(getClassesForPackage(pk));
} else {
classesForPackage.addAll(getClassesForPackage(packageName));
}
for (Class<Object> clazz : classesForPackage) {

jpaClasses.add(clazz);
@@ -140,12 +145,17 @@ public static void main(String[] args) throws Exception {
} else {
gen.initialJpsClassList(pkg);
}

Package hibernate = Package.getPackage("org.hibernate.dialect");
if (hibernate == null) {
hibernate = org.hibernate.dialect.DerbyTenSevenDialect.class.getPackage();
}
List<Class> dialetcs = getClassesForPackage(hibernate);
List<Class> dialetcs = null;
if (hibernate == null) {
dialetcs = getClassesForPackage("org.hibernate.dialect");
} else {
dialetcs = getClassesForPackage(hibernate);
}
for (Class clz : dialetcs) {
try {
org.hibernate.dialect.Dialect d = (org.hibernate.dialect.Dialect) clz.newInstance();
@@ -222,11 +232,13 @@ private static void processJarfile(URL resource, String pkgname, List<Class> cla
}

public static List<Class> getClassesForPackage(Package pkg) {
return getClassesForPackage(pkg.getName());
}

public static List<Class> getClassesForPackage(String pkgname) {
List<Class> classes = new ArrayList<Class>();

String pkgname = pkg.getName();
log(pkgname);
log(pkg.getName());
String relPath = pkgname.replace('.', '/');

// Get a File object for the package

0 comments on commit 9627e3c

Please sign in to comment.