本文整理汇总了Java中com.avaje.ebean.Ebean.save方法的典型用法代码示例。如果您正苦于以下问题:Java Ebean.save方法的具体用法?Java Ebean.save怎么用?Java Ebean.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avaje.ebean.Ebean
的用法示例。
在下文中一共展示了Ebean.save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result create() {
Form<Shop> shopForm =
Form.form(Shop.class).bindFromRequest();
if (shopForm.hasErrors()) {
return status(ErrDefinition.E_SHOP_FORM_ERROR,
Messages.get("shop.failure"));
}
try {
Shop shop = shopForm.get();
shop.id = CodeGenerator.GenerateUUId();
shop.app = Application.find.byId(session("appId"));
Ebean.save(shop);
return ok(Json.toJson(shop));
}
catch (Throwable e) {
return status(ErrDefinition.E_SHOP_CREATE_ERROR,
Messages.get("shop.failure"));
}
}
示例2: create
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result create() {
Form<AnnouncementFeiMei> record = Form.form(AnnouncementFeiMei.class)
.bindFromRequest();
if(record.hasErrors()){
return status(ErrDefinition.E_ENTRY_CREAT_ERROR,
Messages.get("entryform.failure"));
}
AnnouncementFeiMei existAnnouncementFeiMei = AnnouncementFeiMei.find.where()
.eq("account_id",session("userId"))
.orderBy("create_time desc")
.findUnique();
if(existAnnouncementFeiMei==null){
AnnouncementFeiMei announcementFeiMei = record.get();
announcementFeiMei.id = CodeGenerator.GenerateUUId();
announcementFeiMei.create_time = new Date();
announcementFeiMei.accountId = session("userId");
announcementFeiMei.appId = session("appId");
Ebean.save(announcementFeiMei);
return ok(Json.toJson(announcementFeiMei));
}
else{
return ok();
}
}
示例3: create
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result create() {
Form<CouponRecord> recordForm =
Form.form(CouponRecord.class).bindFromRequest();
if (recordForm.hasErrors()) {
return status(ErrDefinition.E_COUPON_RECORD_FORM_ERROR);
}
try {
CouponRecord record = recordForm.get();
record.id = CodeGenerator.GenerateUUId();
record.account = Account.find.byId(record.user_id);
record.coupon = Coupon.find.byId(record.coupon_id);
record.create_time = new Date();
Ebean.save(record);
return ok(Json.toJson(record));
}
catch (Throwable e) {
return status(ErrDefinition.E_COUPON_RECORD_CREATE_ERROR);
}
}
示例4: themeCreateStock
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result themeCreateStock() {
List<Stock> stockList = Stock.find.all();
for(Stock stock:stockList){
Theme theme = new Theme();
theme.id =stock.id;
theme.theme_name = stock.stockName;
Application application = new Application();
application.id = "7248d7fc-1fab-45a6-87fe-5b57e03ac425";
theme.application = application;
theme.theme_class = 2;
Ebean.save(theme);
}
return ok();
}
示例5: create
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result create() {
Form<Application> appForm =
Form.form(Application.class).bindFromRequest();
if (appForm.hasErrors()) {
return status(ErrDefinition.E_APP_FORM_HASERROR,
Messages.get("application.actionfailed"));
}
try {
Application app = appForm.get();
app.id = CodeGenerator.GenerateUUId();
Ebean.save(app);
ObjectNode node = Json.newObject();
node.put("id", app.id);
return ok(node);
}
catch (Throwable e) {
return status(ErrDefinition.E_APP_EXCEPTION_FOUND,
Messages.get("application.actionfailed"));
}
}
示例6: create
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result create() {
Form<Program> programForm =
Form.form(Program.class).bindFromRequest();
if (programForm.hasErrors()) {
return status(ErrDefinition.E_PROGRAM_FORM_HASERROR,
Messages.get("program.failure"));
}
try {
Program program = programForm.get();
program.id = CodeGenerator.GenerateUUId();
program.app_id = session("appId");
Ebean.save(program);
return ok(Json.toJson(program));
}
catch (Throwable e) {
return status(ErrDefinition.E_PROGRAM_CREATE_FAILED,
Messages.get("program.failure"));
}
}
示例7: createBadge
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result createBadge(){
Form<Badge> badge =
Form.form(Badge.class).bindFromRequest();
if (badge.hasErrors()) {
return status(ErrDefinition.E_GIFT_READ_FAILED,
Messages.get("git.failure"));
}
try{
String appId=session("appId");
Badge bad = badge.get();
bad.id=CodeGenerator.GenerateUUId();
bad.app_id=appId;
Ebean.save(bad);
return ok(Json.toJson(bad));
}
catch (Throwable e){
return status(ErrDefinition.E_GIFT_TABLE_ERROR,
Messages.get("git.failure"));
}
}
示例8: createPayout
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@Override
public int createPayout(Payout payout) {
Ebean.save(payout);
// refresh and return auto generated id
Ebean.refresh(payout);
return payout.getId();
}
示例9: create
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result create() {
Form<HotPeopleRank> hotRank =
Form.form(HotPeopleRank.class).bindFromRequest();
if(hotRank.hasErrors()) {
return status(ErrDefinition.E_HOT_RANK_HASERROR,
Messages.get("hotRank.failure"));
}
try{
HotPeopleRank hotPeopleRank = hotRank.get();
List<HotPeopleRank> rankList = HotPeopleRank.find.all();
int maxNum;
if (rankList.size()==0) { maxNum = 0;}
else
{ maxNum = rankList.get(rankList.size()-1).id;}
hotPeopleRank.id = maxNum+1;
// get hotpeople_id
// String getName = hotPeopleRank.name;
// String peopleId = getId(getName);
// hotPeopleRank.peopleUrl = "http://fcwm.24-7.com.cn/assets/member.html?id=" + peopleId;
Ebean.save(hotPeopleRank);
return ok(Json.toJson(hotPeopleRank));
}
catch (Throwable e){
return status(ErrDefinition.E_HOT_RANK_HASERROR,
Messages.get("hotrank.failure"));
}
}
示例10: createTimeOff
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@Override
public int createTimeOff(TimeOff timeoff) {
Ebean.save(timeoff);
// refresh and return auto generated id
Ebean.refresh(timeoff);
return timeoff.getId();
}
示例11: saveShareRecord
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result saveShareRecord(String questionId){
ShareRecord shareRecord = new ShareRecord();
shareRecord.id = CodeGenerator.GenerateUUId();
shareRecord.app = Application.find.byId(session("appId"));
shareRecord.appId = session("appId");
shareRecord.account = Account.find.byId(session("userId"));
Logger.info("eatRecordController "+session("userId"));
shareRecord.userId = session("userId");
// shareRecord.share_url = url;
shareRecord.create_time = new Date();
Ebean.save(shareRecord);
EatRecord existRecord = EatRecord.find.where()
.eq("question_id", questionId)
.eq("account_id", session("userId"))
.eq("app_id", session("appId"))
.findUnique();
if(existRecord == null) {return ok("noAnswerRecord");}
else{
existRecord.isShared = true;
existRecord.num +=1;
Ebean.update(existRecord);
}
return ok(Json.toJson(existRecord));
}
示例12: createAll
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result createAll() {
Form<AppProfile> profileForm =
Form.form(AppProfile.class).bindFromRequest();
if (profileForm.hasErrors()) {
return status(ErrDefinition.E_APPPROFILE_FORM_HASERROR,
Messages.get("appprofile.failure"));
}
String appId = session("appId");
AppProfile profile = profileForm.get();
Account account = new Account();
account.id = CodeGenerator.GenerateUUId();
String accountId = account.id;
account.role = 0;
account.username = "ol-"+CodeGenerator.GenerateUUId();
account.type = 1;
account.create_time = new Date();
Ebean.save(account);
profile.id = new AccountAppId(accountId,appId);
profile.is_verified = true;
if(profile.constellation.id == 0){profile.constellation.id=1;}
Ebean.save(profile);
return ok(Json.toJson(profile));
}
示例13: Create
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result Create(ActivityEntry entry) {
try {
String accountId = session("userId");
String appId = session("appId"); ///
if (accountId == null || appId == null) {
return status(ErrDefinition.E_ENTRY_CREAT_ERROR,
Messages.get("entryform.failure"));
}
List<ActivityEntry> existaccount =
ActivityEntry.find.where()
.eq("account_id", accountId)
.findList();
int num = 0;
num = existaccount.size();
if (num < 3){
entry.id=CodeGenerator.GenerateUUId();
entry.account_id = session("userId"); // generate a uuid for every entry_form
entry.application= session("appId");
entry.create_time = new Date();
entry.num=num;
Ebean.save(entry);
return ok(Json.toJson(entry));
}
else return ok(Json.toJson(num));
}
catch (Throwable e) {
return status(ErrDefinition.E_ENTRY_CREAT_ERROR,
Messages.get("entry.failure"));
}
}
示例14: down
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result down(String articleId){
Article article = Article.find.where()
.eq("article_id", articleId)
.findUnique();
if(article == null){
return status(ErrDefinition.E_ARTICLE_POST_ERROR,
Messages.get("articlepost.failure"));
}
article.isSpecial = false;
Ebean.save(article);
return ok();
}
示例15: internalCreate
import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result internalCreate(EatEntry entry){
try {
String accountId = session("userId");
String appId = session("appId"); ///
if (accountId == null || appId == null) {
return status(ErrDefinition.E_ENTRY_CREAT_ERROR,
Messages.get("entryform.failure"));
}
List<EatEntry> existaccount =
EatEntry.find.where()
.eq("account_id", accountId)
.findList();
int num = 0;
num = existaccount.size();
if (num < 3){
entry.id=CodeGenerator.GenerateUUId();
entry.account = Account.find.where().eq("id", (session("userId"))).findUnique();; // generate a uuid for every entry_form
entry.application = Application.find.where().eq("id",session("appId")).findUnique();;
entry.create_time = new Date();
entry.num=num;
Ebean.save(entry);
return ok(Json.toJson(entry));
}
else return ok(Json.toJson(num));
}
catch (Throwable e) {
return status(ErrDefinition.E_ENTRY_CREAT_ERROR,
Messages.get("entry.failure"));
}
}