我将尝试使用表生成器生成主键。但是当我在表中插入 6 条记录时,primaryKey 表只显示一个值。这是以下代码
我的实体类
package com.generatorvaluetest.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.TableGenerator;
@Entity
public class Snufu {
private int autoId;
private int identityId;
private int sequenceId;
private int tableId;
private String name;
public int getAutoId() {
return autoId;
}
public void setAutoId(int autoId) {
this.autoId = autoId;
}
public int getIdentityId() {
return identityId;
}
public void setIdentityId(int identityId) {
this.identityId = identityId;
}
public int getSequenceId() {
return sequenceId;
}
public void …Run Code Online (Sandbox Code Playgroud) 首先提前致谢。在CKEditor中,当我单击工具箱中的图像选项卡时,图像属性窗口打开,在这个窗口中,我们上传图像,并且图像预览框也在那里,但是当“图像属性”窗口在“图像预览”框中打开时有一些文本类似于此链接 http://ckeditor.com/demo中显示的内容,但我想在初始化时删除“图像预览”框中的默认文本。我们该怎么办?
我正在尝试使用基于 java 的配置将 Oauth2.0 与 Spring Security 集成到 Web 应用程序中。但是当我尝试调整示例应用程序时,我会出现如下异常:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.harmeetsingh13.config.Oauth2SpringSecurityConfig$OauthWebSecurityConfigureAdapter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.oauth2.provider.client.ClientCredentialsTokenEndpointFilter com.harmeetsingh13.config.Oauth2SpringSecurityConfig$OauthWebSecurityConfigureAdapter.clientCredentialsTokenEndpointFilter; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientCredentialsTokenEndpointFilter' defined in class com.harmeetsingh13.config.Oauth2SpringSecurityConfig: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.security.oauth2.provider.client.ClientCredentialsTokenEndpointFilter com.harmeetsingh13.config.Oauth2SpringSecurityConfig.clientCredentialsTokenEndpointFilter(org.springframework.security.authentication.AuthenticationManager)] threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/authentication/InternalAuthenticationServiceException
at …Run Code Online (Sandbox Code Playgroud) 为什么jpa注释应用于字段或getter方法.如果我尝试在setter方法上应用注释,则编译器会生成错误.因为编译器忽略了setter方法的注释.他们背后的原因是什么?
我主要担心的是在mongodb文档中他们使用$elemMatch命令进行查找并从数组中提取元素,但是当我使用时这不起作用.我的文档结构是
{
"_id" : ObjectId("55dea445c3ad8cac03a7ed8e"),
"email" : "james@user.com",
"groups" : [
{
"_id" : ObjectId("55dea4a4c3ad8c8005a7ed8f"),
"name" : "All Group"
}
]}
Run Code Online (Sandbox Code Playgroud)
我想使用mongodb查询从文档中删除组.我的查询是:
db.users.update({"_id": ObjectId('55dea445c3ad8cac03a7ed8e')},
{$pull: {"groups": {$elemMatch: {"_id": ObjectId('55dea4a4c3ad8c8005a7ed8f')}}}})
Run Code Online (Sandbox Code Playgroud)
执行查询后,用户文档未更新,组值仍然存在.我关注mongodb文档:http://docs.mongodb.org/v2.6/reference/operator/update/pull/
我正在创建lagom简单应用程序,定义一个休息终点并使用休息客户端邮递员命中终点.但作为回应我得到,行动没有发现错误.我将Akka与lagom集成,以下是我的代码:
服务:
trait TwitterSchedulerService extends Service {
def doWork: ServiceCall[NotUsed, Done]
override def descriptor: Descriptor = {
import Service._
named("scheduler").withCalls(
call(doWork)
)
}
}
Run Code Online (Sandbox Code Playgroud)
ServiceImpl:
class TwitterSchedulerServiceImpl(system: ActorSystem) extends TwitterSchedulerService {
override def doWork = ServiceCall { _ =>
Future {
println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ")
Done
}
}
}
Run Code Online (Sandbox Code Playgroud)
装载机配置:
class TwitterLoader extends LagomApplicationLoader {
override def load(context: LagomApplicationContext): LagomApplication =
new TwitterApplication(context) {
override def serviceLocator = NoServiceLocator
}
}
object TwitterSerializerRegistry extends JsonSerializerRegistry {
override val serializers = Vector( …Run Code Online (Sandbox Code Playgroud) 每当我尝试从kafka队列中读取消息时,都会收到以下异常:
[error] (run-main-0) java.lang.ClassCastException: org.apache.avro.generic.GenericData$Record cannot be cast to com.harmeetsingh13.java.Customer
java.lang.ClassCastException: org.apache.avro.generic.GenericData$Record cannot be cast to com.harmeetsingh13.java.Customer
at com.harmeetsingh13.java.consumers.avrodesrializer.AvroSpecificDeserializer.infiniteConsumer(AvroSpecificDeserializer.java:79)
at com.harmeetsingh13.java.consumers.avrodesrializer.AvroSpecificDeserializer.main(AvroSpecificDeserializer.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Run Code Online (Sandbox Code Playgroud)
卡夫卡生产者代码:
public class AvroSpecificProducer {
private static Properties kafkaProps = new Properties();
private static KafkaProducer<String, Customer> kafkaProducer;
static {
kafkaProps.put("bootstrap.servers", "localhost:9092");
kafkaProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, KafkaAvroSerializer.class);
kafkaProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, KafkaAvroSerializer.class);
kafkaProps.put("schema.registry.url", "http://localhost:8081");
kafkaProducer = new KafkaProducer<>(kafkaProps);
}
public static void fireAndForget(ProducerRecord<String, Customer> record) {
kafkaProducer.send(record);
}
public static void asyncSend(ProducerRecord<String, Customer> record) {
kafkaProducer.send(record, (recordMetaData, …Run Code Online (Sandbox Code Playgroud) java avro apache-kafka kafka-consumer-api kafka-producer-api
我是网络服务的新手.我尝试jax.ws..用jersey和使用Web服务spring.当我尝试使用Chrome Post Client或CURL在Windows中发送请求时,会发生以下堆栈跟踪.
SEVERE: Servlet.service() for servlet [jersey-serlvet] in context with path [/rest] threw exception [Servlet execution threw an exception] with root cause
java.lang.AbstractMethodError
at org.codehaus.jackson.map.AnnotationIntrospector$Pair.findDeserializer(AnnotationIntrospector.java:1335)
at org.codehaus.jackson.map.deser.BasicDeserializerFactory.findDeserializerFromAnnotation(BasicDeserializerFactory.java:675)
at org.codehaus.jackson.map.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:535)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createDeserializer(StdDeserializerProvider.java:432)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:341)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCacheValueDeserializer(StdDeserializerProvider.java:321)
at org.codehaus.jackson.map.deser.StdDeserializerProvider.findValueDeserializer(StdDeserializerProvider.java:167)
at org.codehaus.jackson.map.deser.StdDeserializerProvider.findTypedValueDeserializer(StdDeserializerProvider.java:188)
at org.codehaus.jackson.map.ObjectMapper._findRootDeserializer(ObjectMapper.java:2820)
at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2690)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1308)
at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)
..............................
Run Code Online (Sandbox Code Playgroud)
以下是我的例子的代码:
@Path("/loginPoint")
@Service
public class UserService {
@Resource(name= "commanUserService")
private CommanUserService commanUserService;
@POST
@Path("/login")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response login(LoginRequest request){
System.out.println("Hello …Run Code Online (Sandbox Code Playgroud) 我试图在jackson-mapper-asl库的帮助下将对象列表转换为json ,但作为响应我得到了http 406错误.jackson-mapper-asl图书馆在我的班级路径上.以下是我的Spring MVC控制器代码:
@RequestMapping(value="/find-sub-categories/{parentId}", method=RequestMethod.GET)
@ResponseBody public List<ProductCategory> findSubCategories(@PathVariable(value="parentId") ProductCategory productCategory) {
logger.info("In ADMIN findSubCategories Contoller AJAX GET");
List<ProductCategory> categories = productCategoryService.findAllChildProductCategoriesByParent(productCategory);
return categories;
}
Run Code Online (Sandbox Code Playgroud)
我的Ajax请求代码:
$.ajax({
url: url+"/"+parentId,
type: 'GET',
success: function(result) {
var arr = $.parseJSON(result);
-----------------------
Run Code Online (Sandbox Code Playgroud) 我是新手,GVM根据其文档,当我运行以下命令安装时GVM,终端上没有输出显示如下:
james@james-K52F:~$ curl -s get.gvmtool.net | bash
james@james-K52F:~$
Run Code Online (Sandbox Code Playgroud)
当我运行该命令后CURL,我收到以下错误:
james@james-K52F:~$ gvm
No command 'gvm' found, but there are 20 similar ones
gvm: command not found
Run Code Online (Sandbox Code Playgroud)
当我点击CURL没有-s标志的命令,然后得到以下错误:
james@james-K52F:~$ curl get.gvmtool.net | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to get.gvmtool.net port 80: Network …Run Code Online (Sandbox Code Playgroud) java ×5
annotations ×2
exception ×2
hibernate ×2
json ×2
rest ×2
akka ×1
apache-kafka ×1
avro ×1
ckeditor ×1
css ×1
gvm ×1
html ×1
installation ×1
javascript ×1
jpa ×1
jpa-2.0 ×1
lagom ×1
mongodb ×1
scala ×1
spring ×1
spring-mvc ×1
ubuntu-14.04 ×1