We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, Team,
I try to run MBG from Java with an XML Configuration, but no java file can be generated & no error infomation, would you help to check? thank you.
=========Java============ public class Table2Class { public static void main(String[] args) {
try { URL url = Thread.currentThread().getContextClassLoader().getResource("generatorConfig.xml"); URI uri = Objects.requireNonNull(url).toURI(); Path path = Paths.get(uri); String content = Files.readString(path); InputStream inputStream = new ByteArrayInputStream(content.getBytes()); List<String> warnings = new ArrayList<>(); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(inputStream); DefaultShellCallback callback = new DefaultShellCallback(true); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); } catch (Exception ex) { System.out.printf(ExceptionUtils.findNestedThrowables(ex).toString()); } }
} ========generatorConfig.xml=========
<jdbcConnection driverClass="org.postgresql.Driver" connectionURL="jdbc:postgresql://127.0.0.1:5432/test" userId="" password=""/> <javaModelGenerator targetPackage="larkisland.db.model" targetProject="src/main/java"/> <sqlMapGenerator targetPackage="larkisland.db.mapper" targetProject="src/main/resources"/> <javaClientGenerator type="XMLMAPPER" targetPackage="larkisland.db.mapper" targetProject="src/main/java"/> <table tableName="test_job" schema="public"/> </context>
============SQL============= CREATE TABLE IF NOT EXISTS public.test_job ( job_id character varying COLLATE pg_catalog."default" NOT NULL, cron character varying COLLATE pg_catalog."default", CONSTRAINT test_pkey PRIMARY KEY (job_id) )
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.test_job OWNER to test;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi, Team,
I try to run MBG from Java with an XML Configuration, but no java file can be generated & no error infomation, would you help to check? thank you.
=========Java============
public class Table2Class {
public static void main(String[] args) {
}
========generatorConfig.xml=========
============SQL=============
CREATE TABLE IF NOT EXISTS public.test_job
(
job_id character varying COLLATE pg_catalog."default" NOT NULL,
cron character varying COLLATE pg_catalog."default",
CONSTRAINT test_pkey PRIMARY KEY (job_id)
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.test_job
OWNER to test;
The text was updated successfully, but these errors were encountered: