Code Monkey home page Code Monkey logo

devon2012's People

Contributors

holyeye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

devon2012's Issues

BaseEntity 클래스를 상속받을 경우 컴파일 오류 발생.

http://stackoverflow.com/questions/12135233/entity-not-recognizing-the-id-in-a-mappedsuperclass

와 관련된 내용입니다.

영한님의 BaseEntity 클래스를 상속받으면

상속받은 클래스에 다음과 같은 오류가 발생하면서 컴파일이 안되더군요.

the entity has no primary key attribute defined

상속받은 클래스에서 위와 같은 메시지가 출력됩니다.

그래서 BaseEntity를 다음과 같이 수정하였습니다. 위의 stackoverflow.com 의 내용을 참고로 하였습니다.

package kr.co.sunnyvale.guestbook.domain;

import java.io.Serializable;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;

import org.springframework.data.jpa.domain.AbstractPersistable;

@MappedSuperclass
@access(AccessType.PROPERTY)
public abstract class BaseEntity extends AbstractPersistable{

private static final long serialVersionUID = -8669707500586538457L;

@Version
@Access(AccessType.FIELD)
private long version;

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
public PK getId() {
    return super.getId();
}

@Override
public void setId(PK id) {
    super.setId(id);
}

}

혹시 더 좋은 방법이 있을까요? eclipse 의 jpa관련된 버그라는 말도 있는 듯 한데. eclipse는 최신버전인데 말입니다. ^^;;;

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.