Giter Site home page Giter Site logo

Comments (32)

MigiKun avatar MigiKun commented on May 3, 2024 20

Any news?

from exposed.

akamuza avatar akamuza commented on May 3, 2024 13

5 years later we still need it. Really )

from exposed.

simonnepomuk avatar simonnepomuk commented on May 3, 2024 11

Bump :)

from exposed.

Displee avatar Displee commented on May 3, 2024 9

Bump :)

from exposed.

downloadpizza avatar downloadpizza commented on May 3, 2024 8

Bumping because this is ridicolous, I just made an IntIdTable now without using the Id ever.

from exposed.

kimble avatar kimble commented on May 3, 2024 7

This issue was created 4 years ago, how is this not fixed yet?

You should ask for your money back

from exposed.

azariiva avatar azariiva commented on May 3, 2024 7

bump

from exposed.

Nek-12 avatar Nek-12 commented on May 3, 2024 7

@Nek-12 Merry Christmas, any updates?

Yeah, lots of updates: I finished school, got into university, finished university, started my masters, found a job and left that job. What a great 8 years!

from exposed.

PGliw avatar PGliw commented on May 3, 2024 6

bump! ⏳

from exposed.

Tapac avatar Tapac commented on May 3, 2024 5

@Hc747, not yet.

from exposed.

Tapac avatar Tapac commented on May 3, 2024 2

@kamyar1979 , sad, but there is not workaround atm, because entityId is a hardly coupled with a single column instance. We have uncompleted refactoring with this feature support, but it requires a lot of testing before release, so we can't give any ETA :(

from exposed.

downloadpizza avatar downloadpizza commented on May 3, 2024 2

grafik

bump

from exposed.

brunoazevedomendonca avatar brunoazevedomendonca commented on May 3, 2024 1

I believe that I found a solution:
https://stackoverflow.com/questions/57633755/kotlin-exposed-entity-for-table-with-no-identity-column

from exposed.

Nek-12 avatar Nek-12 commented on May 3, 2024 1

Merry christmas guys

from exposed.

Tapac avatar Tapac commented on May 3, 2024

Hi, @jorginius .
It's not possible at the moment, but I hope we can fix it in a while.
Do you have any experience with EmbeddedId or IdClass approach? Or maybe you can share your vision how it might be implemented to be mostly useful?

from exposed.

jorginius avatar jorginius commented on May 3, 2024

Hi, @Tapac .

I commented about the EmbeededId (and Embeddable) annotation because I think it could be the less disruptive approach (one object key, one parameter), but I'm not sure if mimicking JPA is the right way on this point:

@Embeddable
public class UserToRoleKey {
   @Column(nullable = false)
   private String code;
   @Column(nullable = false)
   private String username;
   // ...
}

@Entity
public class UserToRole {
    @EmbeddedId
    private UserToRoleKey key;
    // ...
}

// ...
UserToRoleKey key = new UserToRoleKey();
key.setCode("USER");
key.setUsername("test);
entityManager.find(UserToRole.class, key);

"Raw" Table objects can hold a composite key easily:

internal object UsersToRoles : Table("users_roles") {
    val code = reference("code", Roles.code).primaryKey()
    val username = reference("username", Users.username).primaryKey()
}

Perhaps the ideal API :-) has a EntityClass which works with Table objects (creating EntityId from primaryId fields automatically) or IdTable is deprecated/superseded by the "vanilla" Table, i don't know.

from exposed.

kamyar1979 avatar kamyar1979 commented on May 3, 2024

It is my only problem in current project! Please lead me with a workaround at least!

from exposed.

kamyar1979 avatar kamyar1979 commented on May 3, 2024

Sorry! I have to return to old Hibernate for now!

from exposed.

OleksandrSamsonov avatar OleksandrSamsonov commented on May 3, 2024

Need this feature as well :(

from exposed.

rnett avatar rnett commented on May 3, 2024

A very ugly and <8 bit int-specific work around I've been using:

object dgmtypeeffects: IntIdTable(columnName = "typeID\" << 8 | \"effectID") {
    val typeID = integer("typeID").primaryKey()
    val effectID = integer("effectID").primaryKey()
    val isDefault = bool("isDefault")
    val effect = reference("effectID", dgmeffects)
    val type = reference("typeID", invtypes)

    fun idFromPKs(typeID: Int, effectID: Int): Int {
        return typeID shl 8 or effectID
    }

    fun findFromPKs(typeID: Int, effectID: Int): dgmtypeeffect? {
        return dgmtypeeffect.findById(idFromPKs(typeID, effectID))
    }

}

class dgmtypeeffect(id: EntityID<Int>): IntEntity(id) {
    companion object: IntEntityClass<dgmtypeeffect>(dgmtypeeffects)

    var typeID by dgmtypeeffects.typeID
    var effectID by dgmtypeeffects.effectID
    var isDefault by dgmtypeeffects.isDefault
    val effect by dgmeffect referencedOn dgmtypeeffects.effect
    val type by invtype referencedOn dgmtypeeffects.type

}

findByPKs returns the correct object, and accessing these by references in other tables works, I can't say more than that.

The shift could be adjusted, and more values could be added.

from exposed.

jcflorezr avatar jcflorezr commented on May 3, 2024

seems there is a solution here: #239

from exposed.

Hc747 avatar Hc747 commented on May 3, 2024

Have there been any updates on this?

from exposed.

DRSchlaubi avatar DRSchlaubi commented on May 3, 2024

This issue was created 4 years ago, how is this not fixed yet?

from exposed.

PedroD avatar PedroD commented on May 3, 2024

@Tapac is there any README about this on-going feature that the community can read and try to contribute?

from exposed.

Dezzley avatar Dezzley commented on May 3, 2024

Bump 🆙

from exposed.

romsper avatar romsper commented on May 3, 2024

Bump

from exposed.

trebsoj avatar trebsoj commented on May 3, 2024

bump

from exposed.

MoktanP avatar MoktanP commented on May 3, 2024

bump

from exposed.

well-balanced avatar well-balanced commented on May 3, 2024

happy new year

from exposed.

vladovello avatar vladovello commented on May 3, 2024

bump

from exposed.

fengelniederhammer avatar fengelniederhammer commented on May 3, 2024

bump

from exposed.

ilyasKerbal avatar ilyasKerbal commented on May 3, 2024

@Nek-12 Merry Christmas, any updates?

from exposed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.