wwadge / hbnpojogen Goto Github PK
View Code? Open in Web Editor NEWHibernate Pojo Generator
Hibernate Pojo Generator
Hi Wallace,
I'm working with your generator here in MiFinity.
We use database PostgreSQL with UTF-8 encoding.
I've created a table that has some data with Latin characters (Itaú, for example) and I need the equivalent ENUM to be generated with UTF-8 encoding (like the table).
However, the ENUM is generated with wrong encoding: ANSI
Is there any change you can make in your generator to generate UTF-8 encoding, please?
Thanks,
Fernanda.
Hi, I found this project after some research about creating pojo from database and beign upset after noticing that the easiest way is using eclipse with one plugin, but, for who is just looking for an easy way to do its job would be really nice to just download an .jar from release and start using! I also think that if there's one release .jar the popularity of your project would increase a lot
Hi, Is this compatible with Oracle?
best regards.
Hi
I've tried to generate the pojos for one of my mysq databases and faced the following problems.
Stage 2: Getting commit order in 'PARTIAL' strategy
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1911)
at com.felees.hbnpojogen.SyncUtils.getTableCatalog(SyncUtils.java:1295)
at com.felees.hbnpojogen.SyncUtils.getCommitOrder(SyncUtils.java:159)
at com.felees.hbnpojogen.SyncUtils.getCommitOrder(SyncUtils.java:501)
at com.felees.hbnpojogen.HbnPojoGen.sync(HbnPojoGen.java:172)
at com.felees.hbnpojogen.HbnPojoGen.run(HbnPojoGen.java:461)
at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:495)
Stage 4: Building object model
null
java.lang.NullPointerException
at com.felees.hbnpojogen.SyncUtils.removeUnderscores(SyncUtils.java:992)
at com.felees.hbnpojogen.obj.Clazz.setClassPackage(Clazz.java:1040)
at com.felees.hbnpojogen.Core.buildObjectModel(Core.java:768)
at com.felees.hbnpojogen.HbnPojoGen.sync(HbnPojoGen.java:222)
at com.felees.hbnpojogen.HbnPojoGen.run(HbnPojoGen.java:461)
at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:495)
...
Stage 6: Writing interfaces
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
at java.lang.String.substring(String.java:1907)
at com.felees.hbnpojogen.SyncUtils.upfirstChar(SyncUtils.java:814)
at com.felees.hbnpojogen.obj.Clazz.getDataLayerInterfaceFullClassName(Clazz.java:1617)
at com.felees.hbnpojogen.obj.Clazz.getDataLayerImplFullClassName(Clazz.java:1516)
at com.felees.hbnpojogen.VelocityWriters.writeClass(VelocityWriters.java:485)
at com.felees.hbnpojogen.VelocityWriters.writeInterfaceClasses(VelocityWriters.java:767)
at com.felees.hbnpojogen.HbnPojoGen.sync(HbnPojoGen.java:236)
at com.felees.hbnpojogen.HbnPojoGen.run(HbnPojoGen.java:461)
at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:495)
Hi,
I have below configuration and i only want to generate Entity classes not dao, services and test classes. How can i skip generating those packages and files? Also i dont want my generated entities extends IPojoGenEntity, IPost classes. How can i achieve that? Your documentation is really good but i couldn't find these customization details though.
Thanks
<?xml version="1.0" encoding="ISO-8859-1" ?>
<appconfig>
<dbType>MYSQL</dbType>
<driver>com.mysql.jdbc.Driver</driver>
<jdbcConnectionString>jdbc:mysql://localhost:3306/springbootblog
</jdbcConnectionString>
<databaseIP>localhost</databaseIP>
<databaseCatalog>springbootblog</databaseCatalog>
<databaseUsername>mrgenco</databaseUsername>
<databasePassword>***</databasePassword>
<sourceTarget>/Users/mrgenco/Documents/MRG/webapi/</sourceTarget>
<projectName>webapi</projectName>
<topLevel>com.mrg</topLevel>
<libPath>src/main/resources</libPath>
<schemaStrategy>PARTIAL</schemaStrategy>
<resourceFolder>src/main/resources</resourceFolder>
<sourceFolderName>src/main/java</sourceFolderName>
<dbPackageMap>
<map schema="DEFAULT">
<!-- Location of hibernate objects. ${DB} will be replaced by the schema
under operation dynamically. -->
<objectPackage>
${topLevel}.${projectName}.${DB}.model
</objectPackage>
<!-- Location of repository objects (spring data only) -->
<objectTableRepoPackage>
${topLevel}.${projectName}.${DB}.repository
</objectTableRepoPackage>
<objectInterfacePackage skip="true">
${topLevel}.${projectName}.model.obj.${DB}.iface
</objectInterfacePackage>
<!-- Location of repository factory objects. -->
<repositoryFactoryPackage skip="true">
${topLevel}.${projectName}.model.obj.${DB}.repository.factory
</repositoryFactoryPackage>
<!-- Location of hibernate DAO objects. -->
<daoPackage skip="true">
${topLevel}.${projectName}.model.dao.${DB}
</daoPackage>
<!-- Location of hibernate DAO Implementation objects. -->
<daoImplPackage skip="true">
${topLevel}.${projectName}.model.dao.${DB}.impl
</daoImplPackage>
<!-- Location of hibernate enum objects. -->
<enumPackage skip="true" targetbase="/some/other/path">
${topLevel}.${projectName}.enums.db.${DB}
</enumPackage>
<!-- Location of class subtype enum objects. -->
<enumSubtypePackage skip="true">
${topLevel}.${projectName}.enums.subtype.${DB}
</enumSubtypePackage>
<!-- Location of hibernate factory objects. -->
<factoryPackage skip="true">
${topLevel}.${projectName}.factories.${DB}
</factoryPackage>
<!-- Location of repository factory objects. -->
<repositoryFactoryPackage skip="true">
${topLevel}.${projectName}.factories.${DB}
</repositoryFactoryPackage>
<!-- Location of assorted classes -->
<utilPackage skip="true">
${topLevel}.${projectName}.util
</utilPackage>
<!-- Location of data layer objects. -->
<dataPackage skip="true">
${topLevel}.${projectName}.services.data
</dataPackage>
</map>
</dbPackageMap>
<enableSpringData>true</enableSpringData>
</appconfig>
I tried out generating entities with pgsql 10 and received the following exception (I can roll back to 9.6 in the meantime):
org.postgresql.util.PSQLException: ERROR: column t1.tgconstrname does not exist
Position: 113
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedExportedKeys(AbstractJdbc2DatabaseMetaData.java:3477)
at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedKeys(AbstractJdbc2DatabaseMetaData.java:3670)
at com.github.wwadge.hbnpojogen.SyncUtils.getCommitOrder(SyncUtils.java:229)
at com.github.wwadge.hbnpojogen.SyncUtils.getCommitOrder(SyncUtils.java:507)
at com.github.wwadge.hbnpojogen.HbnPojoGen.sync(HbnPojoGen.java:168)
at com.github.wwadge.hbnpojogen.HbnPojoGen.run(HbnPojoGen.java:448)
at com.github.wwadge.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:481)
Are there any plans to update the maven libraries with the recent updates?
https://mvnrepository.com/artifact/com.github.wwadge
Thanks!
The repositories that are generated, e.g. ApplicationUserRepository, look like the following:
public interface ApplicationUserRepository extends JpaRepository<ApplicationUser, Long>, QueryDslPredicateExecutor<ApplicationUser> {
In Spring Boot 2, the Query DSL predicate executor changes to the following:
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
Changing the extends to use the lowercase convention fixes the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.