Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Per-Åke Minborg
    @minborg
    You need to setup the repositories too. You get this setting automatic if you use the speedment initializtier http://speedment.com/initializer
      <repositories>
            <repository>
                <id>speedment-enterprise</id>
                <name>Speedment Enterprise Repositories</name>
                <url>https://repo.speedment.com/nexus/content/repositories/releases/</url>
            </repository>
        </repositories>
    
        <pluginRepositories>
            <pluginRepository>
                <id>speedment-enterprise</id>
                <name>Speedment Enterprise Repositories</name>
                <url>https://repo.speedment.com/nexus/content/repositories/releases/</url>
            </pluginRepository>
        </pluginRepositories>
    `
    Benjamin Evrard
    @bevrard
    Indeed it was missing :-) then I get:
     Failed to retrieve plugin descriptor for com.speedment.enterprise:speedment-enterprise-maven-plugin:3.1.17:
    Per-Åke Minborg
    @minborg
    ok. Let me check that.
    Are you using a proxy?
    Per-Åke Minborg
    @minborg
    in your settings.xml?
    Benjamin Evrard
    @bevrard
    Here is my settings.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <settings xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
               http://maven.apache.org/xsd/settings-1.0.0.xsd">
    
        <localRepository>c:/j/r</localRepository>
    
    
    
        <mirrors>
    
    
             <mirror>
              <id>nexus</id>
              <name>UK Central</name>
              <url>http://uk.maven.org/maven2</url>
              <mirrorOf>central</mirrorOf>
            </mirror>
    
            <mirror>
              <id>speed</id>
              <name>UK Central</name>
              <url>https://repo.speedment.com/nexus/content/repositories/releases/</url>
              <mirrorOf>central</mirrorOf>
            </mirror>
    
        </mirrors>    
    
        <profiles>
    
            <profile>
                <id>nexus</id>
                <repositories>
                    <repository>
                        <id>central</id>
                        <url>http://uk.maven.org/maven2</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <id>central</id>
                        <url>http://uk.maven.org/maven2</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </pluginRepository>
                </pluginRepositories>
            </profile>
    
            <profile>
                <id>speed</id>
                <repositories>
                    <repository>
                        <id>central</id>
                        <url>https://repo.speedment.com/nexus/content/repositories/releases/</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <id>central</id>
                        <url>https://repo.speedment.com/nexus/content/repositories/releases/</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </pluginRepository>
                </pluginRepositories>
            </profile>
    
        </profiles>
    
        <activeProfiles>
            <!-- Make the profile active all the time -->
            <activeProfile>nexus</activeProfile>
            <activeProfile>speed</activeProfile>
    
        </activeProfiles>
    
    
    </settings>
    For me there is no proxy settings
    I'm doing: mvn -U clean install and then mvn speedment:tool
    Per-Åke Minborg
    @minborg
    ok. And you are not behind a firewall that restricts your access in any way?
    Benjamin Evrard
    @bevrard
    It's a company laptop, but I'm not connected to the vpn, so I think that I should not be behind a proxy?
    Benjamin Evrard
    @bevrard
    It finally works
    I add to add the dependency in the pom.xml
    <dependency>
                <groupId>com.speedment.enterprise</groupId>
                <artifactId>speedment-enterprise-maven-plugin</artifactId>
                <version>3.1.17</version>
            </dependency>
    Benjamin Evrard
    @bevrard
    The spring-plugin generates only "GET" method? there is nothing for PUT and POST?
    Per-Åke Minborg
    @minborg
    Great that it works! The spring plugin only generates GET methods but there are many features of the GET method such as filtering, order , skip and limit
    Benjamin Evrard
    @bevrard
    Thanks for your feedback :) speedment is a great tool! (do you plan to add post and put for rest?)
    Per-Åke Minborg
    @minborg
    It is on the to-do list
    Mark Schrijver
    @ractoc
    I'm trying to get the StringToEnumTypeMapper to work. I have a table with an item_type column. This is a string column, which I want to map to an enum in my Java code.
    To do this, I setup the StringToEnumTypeMapper in my pom where I generate the json and the code:
    <plugin>
    <groupId>com.speedment</groupId>
    <artifactId>speedment-maven-plugin</artifactId>
    <version>${speedment.version}</version>
    <dependencies>
    <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>${mysql.version}</version>
    </dependency>
    </dependencies>
    <configuration>
    <dbmsPassword>**</dbmsPassword>
    <configFile>${project.basedir}/src/main/resources/json/speedment.json</configFile>
    <packageLocation>target/generated-sources/java</packageLocation>
    </configuration>
    <executions>
    <execution>
    <id>Add ItemType typeMapper</id>
    <phase>generate-sources</phase>
    <goals>
    <goal>edit</goal>
    </goals>
    <configuration>
    <set>typeMapper:com.speedment.plugins.enums.StringToEnumTypeMapper</set>
    <what>column</what>
    <where>name:item_type</where>
    </configuration>
    </execution>
    <execution>
    <id>Add ItemType enumConstants</id>
    <phase>generate-sources</phase>
    <goals>
    <goal>edit</goal>
    </goals>
    <configuration>
    <set>enumConstants:BOARDGAMES</set>
    <what>column</what>
    <where>name:item_type</where>
    </configuration>
    </execution>
    <execution>
    <id>Generate code for Mysql</id>
    <phase>generate-sources</phase>
    <goals>
    <goal>generate</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    When I run this code, I keep getting the error:
    com.speedment.generator.translator.exception.SpeedmentTranslatorException: Could not find appropriate database type for column 'ColumnImpl {"databaseType": "java.lang.String", "nullable": true, "name": "item_type", "id": "item_type", "ordinalPosition": 4, "typeMapper": "com.speedment.plugins.enums.StringToEnumTypeMapper", "enumConstants": "BOARDGAMES"}'.
    I have the dependency containing the StringToEnumTypeMapper in my dependencies:
    <dependency>
    <groupId>com.speedment</groupId>
    <artifactId>runtime</artifactId>
    <version>${speedment.version}</version>
    <type>pom</type>
    </dependency>
    <dependency>
    <groupId>com.speedment.plugins</groupId>
    <artifactId>enum-generator</artifactId>
    <version>${speedment.version}</version>
    </dependency>
    I keep thinking I'm missing something here, I just can't figure out what that is
    Mark Schrijver
    @ractoc
    ah, nvm. Found it. I forgot to set the component on the speedment plugin:
                    <components>
                        <component>com.speedment.plugins.enums.EnumGeneratorBundle</component>
                    </components>
    Per-Åke Minborg
    @minborg
    Great!
    Mark Schrijver
    @ractoc
    yeah, the application is coming along nicely this way
    I'm amining for a minimal code backend, so I'm using a combo of Lombock with mapstruct
    results in remarkably clean and readable code
    Per-Åke Minborg
    @minborg
    Interesting indeed
    Mark Schrijver
    @ractoc
    lombock removes almost alle constructors, getters, setters and builders
    mapstruct takes care of all bean mappers
    all you need to do is make sure the getters and setters in both beans are the same, and mapstruct does the rest
    Per-Åke Minborg
    @minborg
    Very interesting with MapStruct !
    Mark Schrijver
    @ractoc
    yeah, I hate boilerplate so anything I can do to get rid of that... Which is one of the main reasons I switched to speedment
    all the boilerplate is generated
    Per-Åke Minborg
    @minborg
    MapStruct could provide a bridge between Speedment and many other frameworks.
    Mark Schrijver
    @ractoc
    Yeah
    I use it to bridge between my Sring boot rest interface Model objects and my speedment generted db objects
    works like a charm, all I need to do is: ItemMapper.INSTANCE.modelToDb(item)
    Per-Åke Minborg
    @minborg
    Cool. I think it would make sense to write an article about it
    or someTable.stream().map(ItemMapper.INSTANCE::mopdelToDb)….
    Mark Schrijver
    @ractoc
    public List<ItemModel> getItemList() {
    return itemService.getItemList().map(ItemMapper.INSTANCE::dbToModel).collect(Collectors.toList());
    }
    this is my method for retreiving the full list of items
    Per-Åke Minborg
    @minborg
    :-)
    Mark Schrijver
    @ractoc
    and all I did was write a simple interface
    Per-Åke Minborg
    @minborg
    Really great.
    Mark Schrijver
    @ractoc

    @Mapper
    public interface ItemMapper {
    ItemMapper INSTANCE = Mappers.getMapper(ItemMapper.class);

    ItemImpl modelToDb(ItemModel model);
    
    ItemModel dbToModel(Item item);
    
    @SuppressWarnings("OptionalUsedAsFieldOrParameterType")
    default <T> T unwrapOptional(Optional<T> optional) {
        return optional.orElse(null);
    }

    }

    I'll see if I can write something over the next few days