Skip to content

Earlier version users

gsharma edited this page Jan 15, 2011 · 2 revisions

For JOhm users using v0.3 or older revisions, migrating to v0.4 or later revisions is painless. You simply need to revise all your Model classes by making them not extend Model and instead decorating with @Model annotation. Also, create a simple Id annotated with @Id and provide its getter. And voila, you are all set!

Here's a simple example:

User model represented with JOhm v0.3:

class User extends Model {
  @Attribute
  private String name;
  ..
}

User model represented with JOhm v0.4:

@Model
class User {
  @Id
  private Long id;
  @Attribute
  private String name;
  ..

  public Long getId() {
    return id;
  }
}

JOhm v0.3 and earlier versions, by virtue of classes extending Model, provided various operations like save(), find(), get(), delete() on the Model itself. With v0.4, these same operations are available but as static API on the JOhm class directly.

Clone this wiki locally