简体   繁体   English

HyperJaxb3项目中发生了什么?

[英]What's happening in HyperJaxb3 project?

I understand that the Hyperjaxb3 library will be quite useful for my project, read a couple of descriptions across multiple sites, and decided to embed it into my Spring-Hibernate project. 我知道Hyperjaxb3库对于我的项目将非常有用,阅读了多个站点的几个描述,并决定将其嵌入到Spring-Hibernate项目中。

I have found a reference to Hyperjaxb3 in https://jaxb.java.net/ , which looks pretty official, but the hyperlink - http://confluence.highsource.org/display/HJ3/Home - doesn't open. 我发现到Hyperjaxb3参考https://jaxb.java.net/ ,这看起来很正式,但超链接- http://confluence.highsource.org/display/HJ3/Home -不开。

I have found some old POM examples, included it into my project, and located some of the old versions references, tried to eliminate them, but right now it seems that I am bumping into a dependency on an old Hibernate version, the error is like this: 我找到了一些旧的POM示例,将其包含到我的项目中,并找到了一些旧版本的引用,试图消除它们,但是现在看来,我碰到了对旧Hibernate版本的依赖,错误就像这个:

java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: Provider org.jvnet.hyperjaxb3.hibernate.plugin.HibernatePlugin could not be instantiated: java.lang.NoClassDefFoundError: org/hibernate/type/MutableType java.util.ServiceConfigurationError:com.sun.tools.xjc.Plugin:提供者org.jvnet.hyperjaxb3.hibernate.plugin.HibernatePlugin无法实例化:java.lang.NoClassDefFoundError:org / hibernate / type / MutableType

I am wondering if there is better Maven entry, if the project is alive and how do I use it with moder Hibernate. 我想知道是否有更好的Maven条目,项目是否还在运行以及如何与现代的Hibernate一起使用。

This is my pom excerpt about Hyperjaxb3, where I exclude some outdated links and specify the latest versions of other dependencies: 这是我关于Hyperjaxb3的pom摘录,其中排除了一些过时的链接并指定了其他依赖项的最新版本:

    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>${jaxb-version}</version>
    </dependency>        
    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-xjc</artifactId>
        <version>${jaxb-version}</version>
    </dependency>  
    <!--<dependency>
        <groupId>org.jvnet.hyperjaxb3</groupId>
        <artifactId>hyperjaxb3</artifactId>
        <version>0.6.1</version>
    </dependency>        -->
    <dependency>
        <groupId>org.jvnet.hyperjaxb3</groupId>
        <artifactId>hyperjaxb3-hibernate-plugin</artifactId>
        <version>0.1</version>
        <exclusions>
            <exclusion>
                <groupId>hsqldb</groupId>
                <artifactId>hsqldb</artifactId>
            </exclusion>
            <exclusion>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>net.sf.saxon</groupId>
                <artifactId>saxon</artifactId>
            </exclusion>
            <exclusion>
                <groupId>net.sf.saxon</groupId>
                <artifactId>saxon-dom</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-xjc</artifactId>
            </exclusion>
        </exclusions>
    </dependency>  
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm-attrs</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>3.2.1</version>
    </dependency>

    <dependency>
        <groupId>commons-beanutils</groupId>   
        <artifactId>commons-beanutils</artifactId>
        <version>1.9.2</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>   
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>   
        <artifactId>commons-logging</artifactId>
        <version>1.2</version>
    </dependency>

I am not currently trying to generate annotated Hibernate entity classes, but POJOs from the PurchaseOdrer example. 我目前不是在尝试生成带注释的Hibernate实体类,而是从PurchaseOdrer示例生成POJO。 This is what I currently do: 这是我目前正在做的事情:

public void initializeModel(String name, InputStream src, String dir) throws IOException, URISyntaxException{
    dir = Paths.get(new URL(dir).toURI()).toString();
    File directory = new File(dir);
    directory.mkdirs();

    SchemaCompiler sc = XJC.createSchemaCompiler();
    sc.setDefaultPackageName(this.getClass().getPackage().getName() + ".generated");

    InputSource is = new InputSource(src);
    is.setSystemId(name);

    sc.parseSchema(is);
    S2JJAXBModel model = sc.bind();
    JCodeModel codeModel = model.generateCode(null, null);

    CodeWriter cw = new FileCodeWriter(directory);        
    codeModel.build(cw);
}

Disclaimer: I'm the author of Hyperjaxb3. 免责声明:我是Hyperjaxb3的作者。

The project is hosted on GitHub: 该项目托管在GitHub上:

The latest version 0.6.1 is functional, works as it should. 最新版本0.6.1可以正常运行。

However, I don't develop it actively anymore. 但是,我不再积极开发它。

Will it work with the current version of hibernate? 它可以与当前的休眠版本一起使用吗?

Version 0.6.1 works was tested with Hibernate 4.1.7. 版本0.6.1的作品已在Hibernate 4.1.7中进行了测试。 HJ3 is just a code generator which produces standard JPA-annotated classes. HJ3只是一个代码生成器,可生成标准的JPA注释类。 So chances are pretty good that it will work with latest versions of Hibernate. 因此,它很可能与最新版本的Hibernate一起使用。

I just can't get the 0.6.1 jar from Maven. 我只是无法从Maven获得0.6.1的罐子。 Seems like it was eliminated from maven repositories. 似乎它已从Maven存储库中删除。

Really? 真? Still there. 还在那里。

http://repo1.maven.org/maven2/org/jvnet/hyperjaxb3/hyperjaxb3-ejb-plugin/0.6.1/ http://repo1.maven.org/maven2/org/jvnet/hyperjaxb3/hyperjaxb3-ejb-plugin/0.6.1/

An I don't understand if I need the "hyperjaxb3-hibernate-plugin" 0.1 from the year 2011. 我不知道我是否需要从2011年开始使用的“ hyperjaxb3-hibernate-plugin” 0.1。

You definitely don't. 你绝对不会。

Or do you aware of any fork or an analog? 还是您知道任何叉子或类似物?

Unfortunately, nothing comes close. 不幸的是,没有什么可以接近的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM